Fix users/projects list when domain context is changed

In case of Keystone Multidomain setup, the project and users list
is empty when the domain context is changed. Horizon uses domain
scoped token for keystone api calls to get list of projects and users.
And domain scoped token cannot get information about projects and users
in other domains, the list is empty.

This patch modifies the use of domain scoped token only when domain
context is not modified.

The bug have 3 parts
1. Users are not listed on GUI in different domain
2. Projects are not listed on GUI in different domain
3. Gui hangs during creation of user/project using + option
This patch handles case 1 and 2.

Change-Id: Ibafe3e2eb3ee1ee5c9eb5d2a276a0edfa3e7c607
Partial-Bug: #1826114
Closes-Bug: #1830782
(cherry picked from commit 9aca7a94e2)
This commit is contained in:
Hemanth Nakkina 2019-12-09 14:59:59 +05:30
parent 4b693661b5
commit 02f4d8ab76
1 changed files with 6 additions and 2 deletions

View File

@ -149,8 +149,12 @@ def keystoneclient(request, admin=False):
token_id = user.token.id
if is_multi_domain_enabled():
# Cloud Admin, Domain Admin or Mixed Domain Admin
if is_domain_admin(request):
is_domain_context_specified = bool(
request.session.get("domain_context"))
# If user is Cloud Admin, Domain Admin or Mixed Domain Admin and there
# is no domain context specified, use domain scoped token
if is_domain_admin(request) and not is_domain_context_specified:
domain_token = request.session.get('domain_token')
if domain_token:
token_id = getattr(domain_token, 'auth_token', None)