Merge "Check if user.token attribute exists" into stable/ocata
This commit is contained in:
commit
d5ad4bf25a
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user