mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-20 18:25:29 +01:00
bf59e2de6c
* Add basic role routes * Add API v2 404 handler * Add API v2 home handler pointing to the wiki * Add tons more todos * Add get_*_columns and get_*_column functions for many db models * Modify and add tons of model and controller functions
28 lines
728 B
Python
28 lines
728 B
Python
from app.classes.models.server_permissions import PermissionsServers
|
|
from app.classes.web.base_api_handler import BaseApiHandler
|
|
|
|
|
|
class ApiRolesRoleServersHandler(BaseApiHandler):
|
|
def get(self, role_id: str):
|
|
auth_data = self.authenticate_user()
|
|
if not auth_data:
|
|
return
|
|
(
|
|
_,
|
|
_,
|
|
_,
|
|
superuser,
|
|
_,
|
|
) = auth_data
|
|
|
|
if not superuser:
|
|
return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"})
|
|
|
|
self.finish_json(
|
|
200,
|
|
{
|
|
"status": "ok",
|
|
"data": PermissionsServers.get_server_ids_from_role(role_id),
|
|
},
|
|
)
|