Fix the issue when trying to show user.

Fix the issue when trying to show user and enable admin to show
any users.

Change-Id: I0f009ef88e8c2349406a53bf04804d3604053346
Closes-Bug: #1533016
This commit is contained in:
lvdongbing 2016-01-11 20:41:54 -05:00
parent ae975df884
commit 27d09b9acb
2 changed files with 3 additions and 1 deletions

View File

@ -123,7 +123,7 @@ def user_get(context, user_id, show_deleted=False, tenant_safe=True):
if user is None or user.deleted_at is not None and not deleted_ok:
return None
if tenant_safe and context.tenant_id != user.user_id:
if tenant_safe and context.tenant_id != user.id:
return None
return user

View File

@ -115,6 +115,8 @@ class User(object):
def load(cls, context, user_id=None, user=None, realtime=False,
show_deleted=False, tenant_safe=True):
'''Retrieve a user from database.'''
if context.is_admin:
tenant_safe = False
if user is None:
user = db_api.user_get(context, user_id,
show_deleted=show_deleted,