diff --git a/app/classes/controllers/roles_controller.py b/app/classes/controllers/roles_controller.py index 647902a3..7e20362c 100644 --- a/app/classes/controllers/roles_controller.py +++ b/app/classes/controllers/roles_controller.py @@ -67,10 +67,6 @@ class RolesController: def add_role(role_name, manager): return HelperRoles.add_role(role_name, manager) - @staticmethod - def get_managed_roles(exec_user_id): - return HelperRoles.get_managed_roles(exec_user_id) - class RoleServerJsonType(t.TypedDict): server_id: t.Union[str, int] permissions: str diff --git a/app/classes/controllers/users_controller.py b/app/classes/controllers/users_controller.py index bbaf9a05..b5c129ac 100644 --- a/app/classes/controllers/users_controller.py +++ b/app/classes/controllers/users_controller.py @@ -1,5 +1,6 @@ import logging import typing as t +from app.classes.models.servers import HelperServers from app.classes.models.users import HelperUsers from app.classes.models.roles import HelperRoles @@ -137,6 +138,14 @@ class UsersController: def get_managed_users(exec_user_id): return HelperUsers.get_managed_users(exec_user_id) + @staticmethod + def get_managed_roles(exec_user_id): + return HelperUsers.get_managed_roles(exec_user_id) + + @staticmethod + def get_created_servers(exec_user_id): + return HelperServers.get_total_owned_servers(exec_user_id) + def update_user(self, user_id: str, user_data=None, user_crafty_data=None): if user_crafty_data is None: user_crafty_data = {} diff --git a/app/classes/models/roles.py b/app/classes/models/roles.py index 7c9b98b1..541f67e8 100644 --- a/app/classes/models/roles.py +++ b/app/classes/models/roles.py @@ -40,10 +40,6 @@ class HelperRoles: def get_all_roles(): return Roles.select() - @staticmethod - def get_managed_roles(exec_user_id): - return Roles.select().where(Roles.manager == exec_user_id) - @staticmethod def get_all_role_ids() -> t.List[int]: return [role.role_id for role in Roles.select(Roles.role_id).execute()] diff --git a/app/classes/models/users.py b/app/classes/models/users.py index c3d2a3a8..e625eec2 100644 --- a/app/classes/models/users.py +++ b/app/classes/models/users.py @@ -145,6 +145,11 @@ class HelperUsers: user_query = Users.select().where(Users.manager == exec_user_id) return user_query + @staticmethod + def get_managed_roles(exec_user_id): + roles_query = Roles.select().where(Roles.manager == exec_user_id) + return roles_query + @staticmethod def get_user(user_id): if user_id == 0: