14 lines
538 B
Python
14 lines
538 B
Python
from app.schemas.permissions import PermissionItem, PermissionSnapshotResponse
|
|
|
|
|
|
class PermissionService:
|
|
@staticmethod
|
|
def build_snapshot(authentik_sub: str, permissions: list[tuple[str, str, str, str]]) -> PermissionSnapshotResponse:
|
|
return PermissionSnapshotResponse(
|
|
authentik_sub=authentik_sub,
|
|
permissions=[
|
|
PermissionItem(scope_type=s_type, scope_id=s_id, module=module, action=action)
|
|
for s_type, s_id, module, action in permissions
|
|
],
|
|
)
|