Skip to content

Commit

Permalink
fix acl update error (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
xudifsd authored and Anbang-Hu committed Jan 14, 2020
1 parent 3b3951d commit 0740283
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/RestAPI/dlwsrestapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
logger.info("===========Init Admin Access===============")
global_vars["initAdminAccess"] = True
logger.info('setting admin access!')
ACLManager.UpdateAce("Administrator", AuthorizationManager.GetResourceAclPath("", ResourceType.Cluster), Permission.Admin, False)
ACLManager.UpdateAce("Administrator", AuthorizationManager.GetResourceAclPath("", ResourceType.Cluster), Permission.Admin, 0)
logger.info('admin access given!')


Expand Down
2 changes: 1 addition & 1 deletion src/utils/JobRestAPIUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def UpdateAce(userName, identityName, resourceType, resourceName, permissions):
ret = None
resourceAclPath = AuthorizationManager.GetResourceAclPath(resourceName, resourceType)
if AuthorizationManager.HasAccess(userName, resourceType, resourceName, Permission.Admin):
ret = ACLManager.UpdateAce(identityName, resourceAclPath, permissions, False)
ret = ACLManager.UpdateAce(identityName, resourceAclPath, permissions, 0)
else:
ret = "Access Denied!"
return ret
Expand Down
8 changes: 4 additions & 4 deletions src/utils/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def GetAllAcl():
identities[identityKey].append(ace)

with acl_cache_lock:
acl_cache.update((resources))
acl_cache.update((identities))
acl_cache.update(resources)
acl_cache.update(identities)

except Exception as e:
logger.warn("Fail to get ACL for user %s, ex: %s" , userName, str(e))
Expand Down Expand Up @@ -253,7 +253,7 @@ def GetResourceAcl(resource):

with acl_cache_lock:
acl_cache[resourceKeyPrefix + resource] = ret
acl_cache.update((identities))
acl_cache.update(identities)
except Exception as e:
logger.error("Get resoure acl error for resource: %s, ex: %s", resource, str(e))
finally:
Expand Down Expand Up @@ -334,4 +334,4 @@ def UpdateIdentityInfo(identityName, uid, gid, groups):
logger.error("update identity info error for identity: %s, ex: %s", identityName, str(e))
finally:
dataHandler.Close()
return ret
return ret

0 comments on commit 0740283

Please sign in to comment.