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