mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-18 17:15:13 +01:00
Fix sonar issue
This commit is contained in:
parent
5b4bf46f61
commit
0519a36fe1
@ -84,7 +84,7 @@ class ApiRolesIndexHandler(BaseApiHandler):
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
not superuser
|
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"})
|
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ class ApiRolesIndexHandler(BaseApiHandler):
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
not superuser
|
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"})
|
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class ApiRolesRoleIndexHandler(BaseApiHandler):
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
not superuser
|
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"})
|
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class ApiRolesRoleIndexHandler(BaseApiHandler):
|
|||||||
return
|
return
|
||||||
(
|
(
|
||||||
_,
|
_,
|
||||||
_,
|
exec_user_permissions_crafty,
|
||||||
_,
|
_,
|
||||||
superuser,
|
superuser,
|
||||||
user,
|
user,
|
||||||
@ -139,7 +139,10 @@ class ApiRolesRoleIndexHandler(BaseApiHandler):
|
|||||||
) = auth_data
|
) = auth_data
|
||||||
|
|
||||||
role = self.controller.roles.get_role(role_id)
|
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(
|
return self.finish_json(
|
||||||
400,
|
400,
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user