From 31b75b1c508c74e4b2541aee32efb7d70c7d5ee5 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 20 Aug 2022 10:24:43 -0400 Subject: [PATCH] Remove manager from role when user deleted --- app/classes/controllers/users_controller.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/classes/controllers/users_controller.py b/app/classes/controllers/users_controller.py index c62d209d..bbaf9a05 100644 --- a/app/classes/controllers/users_controller.py +++ b/app/classes/controllers/users_controller.py @@ -2,6 +2,7 @@ import logging import typing as t from app.classes.models.users import HelperUsers +from app.classes.models.roles import HelperRoles from app.classes.models.crafty_permissions import ( PermissionsCrafty, EnumPermissionsCrafty, @@ -244,6 +245,8 @@ class UsersController: def remove_user(self, user_id): for user in self.get_managed_users(user_id): self.update_user(user.user_id, {"manager": None}) + for role in HelperRoles.get_managed_roles(user_id): + HelperRoles.update_role(role.role_id, {"manager": None}) return self.users_helper.remove_user(user_id) @staticmethod