Fix the judgment of app admin

This commit is contained in:
pycook 2020-04-07 18:02:26 +08:00
parent ba2a6a65b5
commit 66476ed254
1 changed files with 3 additions and 2 deletions

View File

@ -127,8 +127,9 @@ def is_app_admin(app=None):
app = app or 'cmdb'
app_id = AppCache.get(app).id
for role in session.get("acl", {}).get("parentRoles", []):
if RoleCache.get_by_name(app_id, role).is_app_admin:
for role_name in session.get("acl", {}).get("parentRoles", []):
role = RoleCache.get_by_name(app_id, role_name)
if role and role.is_app_admin:
return True
return False