Repository navigation
feat: per-user module permissions (RBAC) with admin bypass - #276
Merged
Merged
Conversation
Introduce a module-level permission system so non-admin users can be scoped to a subset of dashboard modules. Adds a `permissions` TEXT column on the `users` table (migration 006, SQLite + PostgreSQL), a central permission catalog in `infra/users/permissions.py`, backend ACL checks across routers, and dashboard gating via `RequirePermission` / `ForbiddenPage` keyed by nav module. `admin` always bypasses every gate; read access and chat/agent use are never gated. Co-Authored-By: CodeBuddy <codebuddy@tencent.com>
…nly)
The host CLI installer is a connectors-module operation and should be
gated by the `connectors` module permission, consistent with the rest of
the connector routes, instead of being admin-only.
The earlier RBAC change demoted this route from `current_admin` but the
test `test_install_cli_forbidden_for_non_admin` still failed because the
`create_user` test helper grants `BASELINE_PERMISSIONS` (which includes
`connectors`) by default, so the "non-admin" user actually held the
permission. Gate the route with `require_permission("connectors")` and
create the test user with `permissions=[]` so it genuinely lacks the
key and is rejected with 403.
Co-Authored-By: CodeBuddy <codebuddy@tencent.com>
jubaoliang
force-pushed
the
feature/user-module-permissions
branch
from
August 14, 2026 05:03
50ae9df to
0e6038d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a module-level permission system so non-admin users can be scoped to a subset of dashboard modules. This is the backend + dashboard RBAC groundwork;
adminalways bypasses every gate.permissionsTEXT column on theuserstable (migration006, both SQLite and PostgreSQL).src/octop/infra/users/permissions.py(keyed by nav module: settings / control / admin), withuser_has_permission,validate_permission_keys, andeffective_permissions.require_permission(...)dependency and directuser_has_permissionchecks (terminal WS, knowledge, etc.).RequirePermission+ForbiddenPagecomponents, replacing the oldRequireAdminguard.adminbypasses all gates; read access and chat/agent use are never gated./auth/meand a permission picker in the user admin panel.Test plan
make allis green (format + lint + typecheck + backend tests + dashboardtscbuild).test_permissions.py,test_permissions_api.py,test_acl_gate_coverage.py,test_user_permissions_column.py,test_knowledge_hint.py, etc.permissions=["terminal"].Notes
uv.lockwas intentionally excluded from this PR: the only diff there isupload-timemetadata added by a neweruvre-lock, with no real dependency change.