Check if user.token attribute exists
If the user is admin or don't have an ID the identity panel will be loaded. In any other case the project panel will be loaded. This will also check if the panel is unregistred, and if the session has expired it will lead to the login screen. Closes-Bug: #1659818 Change-Id: I27300e928855ec10ca5d2a623d636e50d756b698
This commit is contained in:
parent
c39ea1176f
commit
a2386d80fb
@ -26,21 +26,19 @@ MESSAGES_PATH = getattr(settings, 'MESSAGES_PATH', None)
|
||||
|
||||
|
||||
def get_user_home(user):
|
||||
dashboard = None
|
||||
if user.is_superuser:
|
||||
try:
|
||||
token = user.token
|
||||
except AttributeError:
|
||||
raise exceptions.NotAuthenticated()
|
||||
# Domain Admin, Project Admin will default to identity
|
||||
if token.project.get('id') is None or user.is_superuser:
|
||||
try:
|
||||
dashboard = horizon.get_dashboard('admin')
|
||||
dashboard = horizon.get_dashboard('identity')
|
||||
except base.NotRegistered:
|
||||
pass
|
||||
|
||||
if dashboard is None:
|
||||
else:
|
||||
dashboard = horizon.get_default_dashboard()
|
||||
|
||||
# Domain Admin, Project Admin will default to identity
|
||||
if (user.token.project.get('id') is None or
|
||||
(user.is_superuser and user.token.project.get('id'))):
|
||||
dashboard = horizon.get_dashboard('identity')
|
||||
|
||||
return dashboard.get_absolute_url()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user