mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Remove manager from role when user deleted
This commit is contained in:
parent
7a68e08a64
commit
31b75b1c50
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user