Fix general user backup path

This commit is contained in:
amcmanu3 2024-06-25 13:48:17 -04:00
parent 1ba0520c0e
commit 86ecfc35b6

View File

@ -1,3 +1,4 @@
import os
import logging import logging
import json import json
from jsonschema import validate from jsonschema import validate
@ -97,6 +98,10 @@ class ApiServersServerBackupsIndexHandler(BaseApiHandler):
if EnumPermissionsServer.BACKUP not in server_permissions: if EnumPermissionsServer.BACKUP not in server_permissions:
# if the user doesn't have Schedule permission, return an error # if the user doesn't have Schedule permission, return an error
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"}) 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 data["server_id"] = server_id
if not data.get("excluded_dirs", None): if not data.get("excluded_dirs", None):
data["excluded_dirs"] = [] data["excluded_dirs"] = []