Repository navigation
feat(roles): enterprise roles E00 — ten roles, permission catalogue, extra job roles - #503
Merged
Merged
Conversation
…extra job roles
Adds RELEASE_MANAGER, PROJECT_MANAGER, PRODUCT_MANAGER, DEVELOPER and AGENT
beside the five ranks, a 46-permission catalogue (app/core/permissions.py)
and the plumbing every later epic uses. No existing route changes behaviour:
ladder roles' permission sets are computed from rank, and a job role counts
as VIEWER on every guard that names no permission (fail closed).
Slice 1
- UserRole gains five values; permissions.rank_index is the only ladder index
(quality-gate guard backend.single-role-rank-helper).
- require_permission(P) / require_role(X, permission=P); the project role floor
holds a member to every (rank, permission) a route names; writes intersect
instance and project permissions ("the lower of the two decides").
- users.additional_roles / project_members.additional_roles (migration 0261);
members-route grants need every permission of the role; AGENT never granted
through the user or member routes; MFA from QA_LEAD up covers release and
product managers.
- Reviewed per-role access matrix: tests/security_role_access_matrix.json.
Slice 2
- Users, members and invitation APIs and Settings › Users / Members & access
carry extra roles (picker, table line); a refusal names the missing
permissions and a project role caps what its holder hands out there.
- Owner decision D-17: only an administrator gives RELEASE_MANAGER,
PROJECT_MANAGER or PRODUCT_MANAGER (permissions.ADMIN_ONLY_GRANTS); the
Members tab offers a QA lead only the roles they may give.
- GET /api/v1/me/permissions + useMyPermissions().can() in the SPA.
- SSO and SCIM groups mapped to a job role add it as an extra role; the SSO
preview lists them. MFA policy gains required_roles (floor must be a rank).
Feature-flag role lists match extra roles.
- Dev-login and the dev seed gain the four job roles; seed_data.py seeds a
TESTER (D-8); the role crawl and every-role-wording cover them;
frontend.single-role-order guard (70 guards).
- Postgres: SCIM job-role groups and invited extra roles
(integration/test_scim_groups_postgres.py, test_invitations_postgres.py).
- usePermissions.ts unchanged (eager bundle has 8 bytes of headroom); role-aware
helpers in src/lib/roles.ts for lazy pages.
Tests changed to the new expected behaviour: test_role_hierarchy_is_five_tiers
(five ranks, ten roles; D-1), test_mfa (required_roles in the policy response),
test_sso_role_preview (additional_roles in the preview), test_timeline_note_routes
(rank_index), test_job_role_assignment_and_mfa and test_permission_catalogue (D-17).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Anand Topu <anand.goud.2020@gmail.com>
…tion Signed-off-by: Anand Topu <anand.goud.2020@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # backend/app/core/deps.py # backend/app/services/mfa_service.py # docs/reference/api-index.md # docs/reference/api/authentication.md # docs/reference/api/sso-saml.md # docs/reference/data-dictionary.md # docs/reference/migrations.md # user-guide/compliance.md
- Migration renumbered 0261 -> 0266 (down_revision 0265): main added 0261-0265 meanwhile; one alembic head again. Upgrade, downgrade and re-upgrade checked on PostgreSQL 16. - users.update_user_profile / member routes read additional_roles with getattr, so a payload without the field (an older caller, a test double such as test_live_session_token_revocation's) keeps the extra roles. - metric_dimensions.ACTOR_ROLES lists every UserRole value (main's test_operational_metric_dimensions requires it); the cardinality budget for testlookup_test_case_transitions_total grows 600 -> 1100 children, 1200 -> 2200 series (total 21574 -> 22574). - Reference docs regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Anand Topu <anand.goud.2020@gmail.com>
- Iterate UserRole through list(UserRole) in the new role tests, so the loop target is an explicit iterable (same values, same order). - test_role_access_runtime._send passes only the placeholders a path template names (no surplus user_id for paths without one). deps._ROLE_ORDER stays: test_role_hierarchy_is_five_tiers (D-1) and test_agent_configs import it from app.core.deps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Anand Topu <anand.goud.2020@gmail.com>
…r Role column From the "Chart visual baselines (Linux)" run 46179752540 on this branch; the five images that differ, reviewed before committing: - users-row-edit (lab, signal): the Edit User form shows the Extra roles picker under Role / Status. - users-erased-row (lab, paper, signal): the Role column is wider (the role dropdown now lists the job roles), so the row's columns shift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Anand Topu <anand.goud.2020@gmail.com>
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.
Enterprise roles E00 — role and permission foundation
Adds five roles for release teams and AI agents —
RELEASE_MANAGER,PROJECT_MANAGER,PRODUCT_MANAGER,DEVELOPER,AGENT— beside the five ranks, a 46-permission catalogue (backend/app/core/permissions.py), extra job roles per person and per project, and the admin screens to assign them. Every later enterprise-roles epic (E01–E10) builds on this.No existing role changes behaviour. Ladder roles' permission sets are computed from their rank, and a job role counts as VIEWER on every guard that names no permission (fail closed). No production route is converted to
require_permissionyet; the new roles are inert until an administrator assigns them.What is in it
VIEWER < TESTER < QA_ENGINEER < QA_LEAD < ADMIN);permissions.rank_indexis the only ladder index (quality-gate guardsbackend.single-role-rank-helperandfrontend.single-role-order; 70 guards).require_permission(P)/require_role(X, permission=P); the project role floor holds a member to every (rank, permission) a route names; on a project write instance and project permissions intersect ("the lower of the two decides").users.additional_roles,project_members.additional_roles,user_invitations.additional_roles(migration 0266, nullable JSONB; the downgrade maps every new role value back to VIEWER). Users, members and invitation APIs and Settings › Users / Members & access carry them.GET /api/v1/me/permissions?project_id=anduseMyPermissions().can(...)in the SPA.required_roles("Also require it from"); the floor must be a rank.seed_data.pyseeds a TESTER (D-8).user-guide/administration.md(roles),architecture/SECURITY.md,THREAT_MODEL.md,user-guide/compliance.md, CHANGELOG, reference docs.Reviewed access matrix
backend/tests/security_role_access_matrix.jsonlists, for every role-gated route, the roles it admits. Any future change to a role's access shows as a diff there.tests/test_role_access_runtime.pysends real requests as each of the ten roles and checks the answers match it.Tests changed to the new expected behaviour
test_role_hierarchy_is_five_tiers.py(five ranks, ten roles; D-1),test_mfa.py(required_rolesin the policy response),test_sso_role_preview.py(preview gainsadditional_roles),test_timeline_note_routes.py(expectsrank_index),test_operational_metric_dimensions.py's inventory viametric_dimensions.ACTOR_ROLES(every role; cardinality budget +1000 series).Verification (local, CI's package versions, Python 3.14)
Pushed with
SKIP_PUSH_CHECK=1(owner approved): the local pre-push gate runs the whole backend suite serially, about 7 hours on the pushing machine, where bash takes ~5 s to start and the shell-script tests time out. Every check the gate runs was run separately above with CI's package versions.Known follow-ups
users-row-editvisual baseline changes (the Edit User form shows the extra-roles picker): regenerate the Linux baselines on this branch and review them.usePermissions.tsis unchanged (the shell bundle has little headroom), so it reads a job role as VIEWER; per-permission answers come fromuseMyPermissions.🤖 Generated with Claude Code