diff --git a/app/classes/controllers/servers_controller.py b/app/classes/controllers/servers_controller.py index c1d5177c..b0a9044a 100644 --- a/app/classes/controllers/servers_controller.py +++ b/app/classes/controllers/servers_controller.py @@ -134,8 +134,13 @@ class ServersController(metaclass=Singleton): role_id = role.role_id role_data = RolesController.get_role_with_servers(role_id) role_data["servers"] = {server_id} + # Remove server id permissions from role PermissionsServers.delete_roles_permissions(role_id, role_data["servers"]) + # Remove roles from server PermissionsServers.remove_roles_of_server(server_id) + # Remove backup configs tied to server + self.management_helper.remove_backup_config(server_id) + # Finally remove server self.servers_helper.remove_server(server_id) @staticmethod diff --git a/app/classes/models/management.py b/app/classes/models/management.py index 67d1ff9c..c961f002 100644 --- a/app/classes/models/management.py +++ b/app/classes/models/management.py @@ -367,6 +367,10 @@ class HelpersManagement: } return conf + @staticmethod + def remove_backup_config(server_id): + Backups.delete().where(Backups.server_id == server_id).execute() + def set_backup_config( self, server_id: int,