Fix bug where roles could not be deleted.

This commit is contained in:
Andrew 2022-04-12 17:58:59 -04:00
parent 47025bec2a
commit 705da450e7
2 changed files with 6 additions and 3 deletions

View File

@ -8,8 +8,9 @@ logger = logging.getLogger(__name__)
class Roles_Controller: class Roles_Controller:
def __init__(self, users_helper): def __init__(self, users_helper, roles_helper):
self.users_helper = users_helper self.users_helper = users_helper
self.roles_helper = roles_helper
@staticmethod @staticmethod
def get_all_roles(): def get_all_roles():
@ -63,7 +64,7 @@ class Roles_Controller:
role_data = Roles_Controller.get_role_with_servers(role_id) role_data = Roles_Controller.get_role_with_servers(role_id)
Permissions_Servers.delete_roles_permissions(role_id, role_data["servers"]) Permissions_Servers.delete_roles_permissions(role_id, role_data["servers"])
self.users_helper.remove_roles_from_role_id(role_id) 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 @staticmethod
def role_id_exists(role_id): def role_id_exists(role_id):

View File

@ -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.controllers.servers_controller import Servers_Controller
from app.classes.models.server_permissions import Enum_Permissions_Server from app.classes.models.server_permissions import Enum_Permissions_Server
from app.classes.models.users import helper_users 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.management import helpers_management
from app.classes.models.servers import helper_servers from app.classes.models.servers import helper_servers
from app.classes.shared.authentication import Authentication from app.classes.shared.authentication import Authentication
@ -39,6 +40,7 @@ class Controller:
self.helper = helper self.helper = helper
self.server_jars = ServerJars(helper) self.server_jars = ServerJars(helper)
self.users_helper = helper_users(database, self.helper) self.users_helper = helper_users(database, self.helper)
self.roles_helper = helper_roles(database)
self.servers_helper = helper_servers(database) self.servers_helper = helper_servers(database)
self.management_helper = helpers_management(database, self.helper) self.management_helper = helpers_management(database, self.helper)
self.authentication = Authentication(self.helper) self.authentication = Authentication(self.helper)
@ -46,7 +48,7 @@ class Controller:
self.stats = Stats(self.helper, self) self.stats = Stats(self.helper, self)
self.crafty_perms = Crafty_Perms_Controller() self.crafty_perms = Crafty_Perms_Controller()
self.management = Management_Controller(self.management_helper) 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.server_perms = Server_Perms_Controller()
self.servers = Servers_Controller(self.servers_helper) self.servers = Servers_Controller(self.servers_helper)
self.users = Users_Controller( self.users = Users_Controller(