mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-18 17:15:13 +01:00
Adjust API calls for snapshot option
This commit is contained in:
parent
fcd1a806f8
commit
a4256b66e8
@ -1331,6 +1331,7 @@ class PanelHandler(BaseHandler):
|
||||
server_id = self.get_argument("id", None)
|
||||
backup_id = self.get_argument("backup_id", None)
|
||||
page_data["active_link"] = "backups"
|
||||
page_data["new_backup"] = True
|
||||
page_data["permissions"] = {
|
||||
"Commands": EnumPermissionsServer.COMMANDS,
|
||||
"Terminal": EnumPermissionsServer.TERMINAL,
|
||||
|
@ -8,7 +8,7 @@ from app.classes.web.base_api_handler import BaseApiHandler
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
backup_patch_schema = {
|
||||
backup_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backup_name": {"type": "string", "minLength": 3, "error": "backupName"},
|
||||
@ -48,12 +48,13 @@ backup_patch_schema = {
|
||||
"error": "typeList",
|
||||
"fill": True,
|
||||
},
|
||||
"snapshot": {"type": "boolean", "error": "typeBool", "fill": True},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"minProperties": 1,
|
||||
}
|
||||
|
||||
basic_backup_patch_schema = {
|
||||
basic_backup_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backup_name": {"type": "string", "minLength": 3, "error": "backupName"},
|
||||
@ -87,6 +88,7 @@ basic_backup_patch_schema = {
|
||||
"error": "typeList",
|
||||
"fill": True,
|
||||
},
|
||||
"snapshot": {"type": "boolean", "error": "typeBool", "fill": True},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"minProperties": 1,
|
||||
@ -135,9 +137,9 @@ class ApiServersServerBackupsIndexHandler(BaseApiHandler):
|
||||
|
||||
try:
|
||||
if auth_data[4]["superuser"]:
|
||||
validate(data, backup_patch_schema)
|
||||
validate(data, backup_schema)
|
||||
else:
|
||||
validate(data, basic_backup_patch_schema)
|
||||
validate(data, basic_backup_schema)
|
||||
except ValidationError as why:
|
||||
offending_key = ""
|
||||
if why.schema.get("fill", None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user