Move django-openstack-auth to openstack-build
[openstack-build/django_openstack_auth-build.git] / centos7 / rpm / SOURCES / 0002-Set-default-value-for-new-token-attributes.patch
1 From a4816a01a49db78d3b457d09f257329a0dc99f3c Mon Sep 17 00:00:00 2001
2 From: lin-hua-cheng <os.lcheng@gmail.com>
3 Date: Tue, 5 May 2015 10:07:45 -0700
4 Subject: [PATCH] Set default value for new token attributes
5
6 Two new attributes were recently added to token object:
7 'unscoped_token' and 'is_federated'. When performing an
8 upgrade, the existing token object stored in the session
9 will not have the two attributes yet.  This patch fixes
10 the issue by providing a default value so it won't interrupt
11 service for existing login user during an upgrade.
12
13 Change-Id: I6adf974876294168e2326b5e10c14da2dd3e52ea
14 Closes-bug: #1451934
15 (cherry picked from commit d8f5c949df8adea1e932e9ff3d1f39a1af014d16)
16 (cherry picked from commit d19c032abf932a6afc49423dc096fa8238e62687)
17 ---
18  openstack_auth/user.py | 5 +++--
19  1 file changed, 3 insertions(+), 2 deletions(-)
20
21 diff --git a/openstack_auth/user.py b/openstack_auth/user.py
22 index 811fe84..132e37b 100644
23 --- a/openstack_auth/user.py
24 +++ b/openstack_auth/user.py
25 @@ -55,8 +55,9 @@ def create_user_from_token(request, token, endpoint, services_region=None):
26                  roles=token.roles,
27                  endpoint=endpoint,
28                  services_region=svc_region,
29 -                is_federated=token.is_federated,
30 -                unscoped_token=token.unscoped_token)
31 +                is_federated=getattr(token, 'is_federated', False),
32 +                unscoped_token=getattr(token, 'unscoped_token',
33 +                                       request.session.get('unscoped_token')))
34  
35  
36  class Token(object):