From 1ba0520c0eff1d4509a00032418f71bd40ad7ed0 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Tue, 25 Jun 2024 13:33:52 -0400 Subject: [PATCH 1/2] Fix dir exclusions --- app/classes/models/management.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/classes/models/management.py b/app/classes/models/management.py index d44306eb..1a3e4a11 100644 --- a/app/classes/models/management.py +++ b/app/classes/models/management.py @@ -397,6 +397,9 @@ class HelpersManagement: Backups.delete().where(Backups.backup_id == backup_id).execute() def add_backup_config(self, conf) -> str: + if "excluded_dirs" in conf: + dirs_to_exclude = ",".join(conf["excluded_dirs"]) + conf["excluded_dirs"] = dirs_to_exclude backup = Backups.create(**conf) logger.debug("Creating new backup record.") return backup.backup_id From 86ecfc35b6cd00deecb3cac33d21efbd404575d5 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Tue, 25 Jun 2024 13:48:17 -0400 Subject: [PATCH 2/2] Fix general user backup path --- app/classes/web/routes/api/servers/server/backups/index.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/classes/web/routes/api/servers/server/backups/index.py b/app/classes/web/routes/api/servers/server/backups/index.py index de82f98a..a155f943 100644 --- a/app/classes/web/routes/api/servers/server/backups/index.py +++ b/app/classes/web/routes/api/servers/server/backups/index.py @@ -1,3 +1,4 @@ +import os import logging import json from jsonschema import validate @@ -97,6 +98,10 @@ class ApiServersServerBackupsIndexHandler(BaseApiHandler): if EnumPermissionsServer.BACKUP not in server_permissions: # if the user doesn't have Schedule permission, return an error return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"}) + # Set the backup location automatically for non-super users. We should probably + # make the default location configurable for SU eventually + if not auth_data[4]["superuser"]: + data["backup_location"] = os.path.join(self.helper.backup_path, server_id) data["server_id"] = server_id if not data.get("excluded_dirs", None): data["excluded_dirs"] = []