Fix logical issues with panel handler

This commit is contained in:
amcmanu3 2022-08-20 20:58:46 -04:00
parent 6b82170d6f
commit 02b6c3b545
2 changed files with 13 additions and 10 deletions

View File

@ -254,7 +254,7 @@ class UsersController:
def remove_user(self, user_id): def remove_user(self, user_id):
for user in self.get_managed_users(user_id): for user in self.get_managed_users(user_id):
self.update_user(user.user_id, {"manager": None}) self.update_user(user.user_id, {"manager": None})
for role in HelperRoles.get_managed_roles(user_id): for role in HelperUsers.get_managed_roles(user_id):
HelperRoles.update_role(role.role_id, {"manager": None}) HelperRoles.update_role(role.role_id, {"manager": None})
return self.users_helper.remove_user(user_id) return self.users_helper.remove_user(user_id)

View File

@ -1313,7 +1313,7 @@ class PanelHandler(BaseHandler):
if ( if (
EnumPermissionsCrafty.ROLES_CONFIG not in exec_user_crafty_permissions EnumPermissionsCrafty.ROLES_CONFIG not in exec_user_crafty_permissions
and exec_user["user_id"] != role["manager"] or exec_user["user_id"] != role["manager"]
and not exec_user["superuser"] and not exec_user["superuser"]
): ):
self.redirect( self.redirect(
@ -2042,7 +2042,10 @@ class PanelHandler(BaseHandler):
else: else:
manager = user["manager"] manager = user["manager"]
if not exec_user["superuser"] and exec_user["user_id"] != user["user_id"]: if (
not exec_user["superuser"]
and int(exec_user["user_id"]) != user["manager"]
):
if username is None or username == "": if username is None or username == "":
self.redirect("/panel/error?error=Invalid username") self.redirect("/panel/error?error=Invalid username")
return return