1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-25 01:38:08 +00:00

Comment unused code

This commit is contained in:
grossmj 2023-08-27 18:23:10 +10:00
parent 60ce1172e0
commit 57197c3d1c

View File

@ -362,32 +362,32 @@ class RbacRepository(BaseRepository):
return True return True
query = select(models.Permission).\ # query = select(models.Permission).\
join(models.Permission.roles).\ # join(models.Permission.roles).\
join(models.Role.groups).\ # join(models.Role.groups).\
join(models.UserGroup.users).\ # join(models.UserGroup.users).\
filter(models.User.user_id == user_id).\ # filter(models.User.user_id == user_id).\
order_by(models.Permission.path.desc()) # order_by(models.Permission.path.desc())
#
result = await self._db_session.execute(query) # result = await self._db_session.execute(query)
permissions = result.scalars().all() # permissions = result.scalars().all()
log.debug(f"RBAC: checking authorization for user '{user_id}' on {method} '{path}'") # log.debug(f"RBAC: checking authorization for user '{user_id}' on {method} '{path}'")
matched_permission = self._match_permission(permissions, method, path) # matched_permission = self._match_permission(permissions, method, path)
if matched_permission: # if matched_permission:
log.debug(f"RBAC: matched role permission {matched_permission.methods} " # log.debug(f"RBAC: matched role permission {matched_permission.methods} "
f"{matched_permission.path} {matched_permission.action}") # f"{matched_permission.path} {matched_permission.action}")
if matched_permission.action == "DENY": # if matched_permission.action == "DENY":
return False # return False
return True # return True
#
log.debug(f"RBAC: could not find a role permission, checking user permissions...") # log.debug(f"RBAC: could not find a role permission, checking user permissions...")
permissions = await self.get_user_permissions(user_id) # permissions = await self.get_user_permissions(user_id)
matched_permission = self._match_permission(permissions, method, path) # matched_permission = self._match_permission(permissions, method, path)
if matched_permission: # if matched_permission:
log.debug(f"RBAC: matched user permission {matched_permission.methods} " # log.debug(f"RBAC: matched user permission {matched_permission.methods} "
f"{matched_permission.path} {matched_permission.action}") # f"{matched_permission.path} {matched_permission.action}")
if matched_permission.action == "DENY": # if matched_permission.action == "DENY":
return False # return False
return True # return True
#
return False # return False