Fix sonar issue

This commit is contained in:
amcmanu3 2024-07-08 20:39:21 -04:00
parent 5b4bf46f61
commit 0519a36fe1
2 changed files with 8 additions and 5 deletions

View File

@ -84,7 +84,7 @@ class ApiRolesIndexHandler(BaseApiHandler):
if (
not superuser
and not EnumPermissionsCrafty.ROLES_CONFIG in exec_user_permissions_crafty
and EnumPermissionsCrafty.ROLES_CONFIG not in exec_user_permissions_crafty
):
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
@ -117,7 +117,7 @@ class ApiRolesIndexHandler(BaseApiHandler):
if (
not superuser
and not EnumPermissionsCrafty.ROLES_CONFIG in exec_user_permissions_crafty
and EnumPermissionsCrafty.ROLES_CONFIG not in exec_user_permissions_crafty
):
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})

View File

@ -80,7 +80,7 @@ class ApiRolesRoleIndexHandler(BaseApiHandler):
if (
not superuser
and not EnumPermissionsCrafty.ROLES_CONFIG in exec_user_permissions_crafty
and EnumPermissionsCrafty.ROLES_CONFIG not in exec_user_permissions_crafty
):
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
@ -131,7 +131,7 @@ class ApiRolesRoleIndexHandler(BaseApiHandler):
return
(
_,
_,
exec_user_permissions_crafty,
_,
superuser,
user,
@ -139,7 +139,10 @@ class ApiRolesRoleIndexHandler(BaseApiHandler):
) = auth_data
role = self.controller.roles.get_role(role_id)
if not superuser and user["user_id"] != role["manager"]:
if not superuser and (
user["user_id"] != role["manager"]
or EnumPermissionsCrafty.ROLES_CONFIG not in exec_user_permissions_crafty
):
return self.finish_json(
400,
{