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): def get_user_home(user):
dashboard = None try:
if user.is_superuser: 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: try:
dashboard = horizon.get_dashboard('admin') dashboard = horizon.get_dashboard('identity')
except base.NotRegistered: except base.NotRegistered:
pass pass
else:
if dashboard is None:
dashboard = horizon.get_default_dashboard() 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() return dashboard.get_absolute_url()