Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /session_based_access_control /DeepselSystems_deepsel-cms.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Subject", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "The admin web UI that sends the session_id cookie is not in the checked-out tree (only backend/ and mcp/ exist), so the caller is outside the repo. The in-repo MCP client (mcp/deepsel_cms_mcp/client.py:23 _auth_headers) sends a JWT Bearer token, which hits the JWT fallback rather than the session path, so it does not count." | |
| }, | |
| { | |
| "role": "Authentication enforcer", | |
| "status": "present", | |
| "symbol": "get_current_user", | |
| "file": "backend/apps/core/utils/get_current_user.py", | |
| "lines": "57", | |
| "notes": "This is the FastAPI dependency injected via Depends(get_current_user) on the anchor handler restore_content_revision (backend/apps/cms/routers/revision.py:30), and globally for CRUD routers via configure_crud_router (backend/main.py:100). It first calls _resolve_user_from_session (line 86) and raises 401 if there is neither a session nor a valid token. If no session matches, it falls back to a JWT Bearer token (jwt.decode at line 100); that is the verifiable-token path, not this pattern." | |
| }, | |
| { | |
| "role": "Verifier", | |
| "status": "present", | |
| "symbol": "_resolve_user_from_session", | |
| "file": "backend/apps/core/utils/get_current_user.py", | |
| "lines": "31", | |
| "notes": "get_current_user calls it at get_current_user.py:86. It reads the opaque session_id cookie (SESSION_COOKIE_NAME, settings.py:82) and looks it up in the server-side session store (line 41). It returns None if there is no open session; otherwise it loads the user by session_data.user_id (line 46)." | |
| }, | |
| { | |
| "role": "Session manager", | |
| "status": "external", | |
| "symbol": "get", | |
| "file": "backend/apps/core/utils/get_current_user.py", | |
| "lines": "41", | |
| "notes": "_resolve_user_from_session calls session_store.get(session_id) here. The store is built by the deepsel library's deepsel.auth.session.create_session_store (backend/main.py:90), which uses a Redis, Postgres or filesystem backend (auto-detected by default, settings.py:72), and it is attached to app.state. Sessions are created by the store in /token login (backend/apps/core/routers/auth.py:106) and deleted at logout (auth.py:157). The Starlette SessionMiddleware (main.py:143) is a separate signed-cookie mechanism and is not used for authentication." | |
| }, | |
| { | |
| "role": "Authorisation enforcer", | |
| "status": "present", | |
| "symbol": "restore_content_revision", | |
| "file": "backend/apps/cms/routers/revision.py", | |
| "lines": "27", | |
| "notes": "After get_current_user returns the principal (revision.py:30), the handler itself calls content._check_has_permission(PermissionAction.write, user) at revision.py:59 and raises 403 'Permission denied' when that fails (lines 60-61). The same handler pattern appears in draft.py (save_draft, draft.py:187)." | |
| }, | |
| { | |
| "role": "Decider", | |
| "status": "external", | |
| "symbol": "_check_has_permission", | |
| "file": "backend/apps/cms/routers/revision.py", | |
| "lines": "59", | |
| "notes": "Called by restore_content_revision (revision.py:59). It is inherited from the deepsel library ORM mixin (deepsel.orm, via ORMBaseMixin in backend/apps/core/mixins/orm.py) and checks the user's role permissions ('table:action:scope') for the write action, returning [allowed, scope]. No in-repo override exists." | |
| }, | |
| { | |
| "role": "Policy provider", | |
| "status": "present", | |
| "symbol": "permissions", | |
| "file": "backend/apps/core/models/role.py", | |
| "lines": "14", | |
| "notes": "The deepsel _check_has_permission decision reads the user's roles (UserModel.roles relationship, backend/apps/core/models/user.py:41) and their RoleModel.permissions column, a repo-declared 'table:action:scope' policy string seeded from apps/*/data/role.csv. The retrieval method (get_user_permissions) is inherited from deepsel's UserMixin, so the repo-declared column is cited." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "restore_content_revision", | |
| "file": "backend/apps/cms/routers/revision.py", | |
| "lines": "27", | |
| "notes": "The business action runs in the same handler after the 403 check at revision.py:59-61: it fetches the revision, restores content.content from revision.new_content, clears the draft fields and records a new revision. The Authorisation enforcer is the same method because the check is inline." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 4.55 kB
- Xet hash:
- 12ff77f38db3d62732826bc71240710a7b2beca58e2c62dc992bc949d516423b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.