Merge "Check if user.token attribute exists" into stable/ocata

This commit is contained in:
Jenkins 2017-02-08 05:20:34 +00:00 committed by Gerrit Code Review
commit d5ad4bf25a

View File

@ -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()