Fix general user support logs

This commit is contained in:
Andrew 2022-06-02 08:23:18 -04:00
parent 50872e2bb5
commit fae4ff12ea

View File

@ -18,10 +18,10 @@ from app.classes.controllers.roles_controller import RolesController
from app.classes.controllers.server_perms_controller import ServerPermsController
from app.classes.controllers.servers_controller import ServersController
from app.classes.models.server_permissions import EnumPermissionsServer
from app.classes.shared.main_models import DatabaseShortcuts
from app.classes.models.users import HelperUsers
from app.classes.models.roles import HelperRoles
from app.classes.models.management import HelpersManagement
from app.classes.shared.tasks import TasksManager
from app.classes.models.servers import HelperServers
from app.classes.shared.authentication import Authentication
from app.classes.shared.console import Console
@ -39,7 +39,6 @@ class Controller:
self.users_helper: HelperUsers = HelperUsers(database, self.helper)
self.roles_helper: HelperRoles = HelperRoles(database)
self.servers_helper: HelperServers = HelperServers(database)
self.tasks_manager: TasksManager = TasksManager()
self.management_helper: HelpersManagement = HelpersManagement(
database, self.helper
)
@ -90,11 +89,17 @@ class Controller:
server_path = os.path.join(full_temp, "server")
os.mkdir(server_path)
if exec_user["superuser"]:
auth_servers = self.servers.get_all_defined_servers()
auth_servers = self.servers.list_defined_servers()
else:
user_servers = self.servers.get_authorized_servers(
defined_servers = self.servers.get_authorized_servers(
int(exec_user["user_id"])
)
user_servers = []
for server in defined_servers:
if server not in user_servers:
user_servers.append(
DatabaseShortcuts.get_data_obj(server.server_object)
)
auth_servers = []
for server in user_servers:
if (
@ -866,10 +871,6 @@ class Controller:
)
# Cleanup scheduled tasks
try:
self.tasks_manager.remove_all_server_tasks(server_id)
except:
logger.info(f"Could not find active jobs for server {server_id}")
try:
HelpersManagement.delete_scheduled_task_by_server(server_id)
except DoesNotExist: