From 705da450e74b309b1631aae34b08445af0b72070 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 12 Apr 2022 17:58:59 -0400 Subject: [PATCH] Fix bug where roles could not be deleted. --- app/classes/controllers/roles_controller.py | 5 +++-- app/classes/shared/main_controller.py | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/classes/controllers/roles_controller.py b/app/classes/controllers/roles_controller.py index 3c6f7c44..90a357f1 100644 --- a/app/classes/controllers/roles_controller.py +++ b/app/classes/controllers/roles_controller.py @@ -8,8 +8,9 @@ logger = logging.getLogger(__name__) class Roles_Controller: - def __init__(self, users_helper): + def __init__(self, users_helper, roles_helper): self.users_helper = users_helper + self.roles_helper = roles_helper @staticmethod def get_all_roles(): @@ -63,7 +64,7 @@ class Roles_Controller: role_data = Roles_Controller.get_role_with_servers(role_id) Permissions_Servers.delete_roles_permissions(role_id, role_data["servers"]) self.users_helper.remove_roles_from_role_id(role_id) - return helper_roles.remove_role(role_id) + return self.roles_helper.remove_role(role_id) @staticmethod def role_id_exists(role_id): diff --git a/app/classes/shared/main_controller.py b/app/classes/shared/main_controller.py index 3bb16e1c..35fb2f55 100644 --- a/app/classes/shared/main_controller.py +++ b/app/classes/shared/main_controller.py @@ -20,6 +20,7 @@ from app.classes.controllers.server_perms_controller import Server_Perms_Control from app.classes.controllers.servers_controller import Servers_Controller from app.classes.models.server_permissions import Enum_Permissions_Server from app.classes.models.users import helper_users +from app.classes.models.roles import helper_roles from app.classes.models.management import helpers_management from app.classes.models.servers import helper_servers from app.classes.shared.authentication import Authentication @@ -39,6 +40,7 @@ class Controller: self.helper = helper self.server_jars = ServerJars(helper) self.users_helper = helper_users(database, self.helper) + self.roles_helper = helper_roles(database) self.servers_helper = helper_servers(database) self.management_helper = helpers_management(database, self.helper) self.authentication = Authentication(self.helper) @@ -46,7 +48,7 @@ class Controller: self.stats = Stats(self.helper, self) self.crafty_perms = Crafty_Perms_Controller() self.management = Management_Controller(self.management_helper) - self.roles = Roles_Controller(self.users_helper) + self.roles = Roles_Controller(self.users_helper, self.roles_helper) self.server_perms = Server_Perms_Controller() self.servers = Servers_Controller(self.servers_helper) self.users = Users_Controller(