mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Refactor api handler to use constant id error
This commit is contained in:
parent
16eca86a10
commit
f8884ab93e
@ -49,6 +49,7 @@ BASIC_BACKUP_PATCH_SCHEMA = {
|
|||||||
"additionalProperties": False,
|
"additionalProperties": False,
|
||||||
"minProperties": 1,
|
"minProperties": 1,
|
||||||
}
|
}
|
||||||
|
ID_MISMATCH = "Server ID backup server ID different"
|
||||||
|
|
||||||
|
|
||||||
class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler):
|
class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler):
|
||||||
@ -69,7 +70,7 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler):
|
|||||||
{
|
{
|
||||||
"status": "error",
|
"status": "error",
|
||||||
"error": "ID_MISMATCH",
|
"error": "ID_MISMATCH",
|
||||||
"error_data": "Server ID backup server ID different",
|
"error_data": ID_MISMATCH,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
server_permissions = self.controller.server_perms.get_permissions(mask)
|
server_permissions = self.controller.server_perms.get_permissions(mask)
|
||||||
@ -94,7 +95,7 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler):
|
|||||||
{
|
{
|
||||||
"status": "error",
|
"status": "error",
|
||||||
"error": "ID_MISMATCH",
|
"error": "ID_MISMATCH",
|
||||||
"error_data": "Server ID backup server ID different",
|
"error_data": ID_MISMATCH,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if not auth_data:
|
if not auth_data:
|
||||||
@ -165,7 +166,7 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler):
|
|||||||
{
|
{
|
||||||
"status": "error",
|
"status": "error",
|
||||||
"error": "ID_MISMATCH",
|
"error": "ID_MISMATCH",
|
||||||
"error_data": "Server ID backup server ID different",
|
"error_data": ID_MISMATCH,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -338,7 +339,7 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler):
|
|||||||
{
|
{
|
||||||
"status": "error",
|
"status": "error",
|
||||||
"error": "ID_MISMATCH",
|
"error": "ID_MISMATCH",
|
||||||
"error_data": "Server ID backup server ID different",
|
"error_data": ID_MISMATCH,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
mask = self.controller.server_perms.get_lowest_api_perm_mask(
|
mask = self.controller.server_perms.get_lowest_api_perm_mask(
|
||||||
@ -372,7 +373,7 @@ class ApiServersServerBackupsBackupFilesIndexHandler(BaseApiHandler):
|
|||||||
{
|
{
|
||||||
"status": "error",
|
"status": "error",
|
||||||
"error": "ID_MISMATCH",
|
"error": "ID_MISMATCH",
|
||||||
"error_data": "Server ID backup server ID different",
|
"error_data": ID_MISMATCH,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if not auth_data:
|
if not auth_data:
|
||||||
|
Loading…
Reference in New Issue
Block a user