Skip to content

Backend: update custom role (metadata + permissions) endpoints #590

Done

Description

@rodmgwgu

Implement the update custom role endpoint defined in ADR 0036: PATCH /api/authz/v1/roles/<role_id>/ changes the description, the permissions, or both, of a custom role.

  1. Description — edit the description (backs the inline pencil Frontend: Edit a custom role description (inline pencil) #578). The name cannot be changed after creation.
  2. Permissions — permissions replaces the role's full permission list (backs the editable Permissions tab Frontend: Role detail Permissions tab (custom roles, editable) #577).

Both persist via the custom-roles model (#561) and re-render the affected Casbin p rows in the same transaction. Staff or superuser only. Static roles are read-only.

Acceptance

  • PATCH accepts description and/or permissions and returns 200 with the role object (including user_count and updated_at).
  • display_name or scope_types in the request returns 400; the name and resource type cannot change.
  • Description is free text, may be empty, and is stored without translation.
  • Permissions must be non-empty and support the role's resource type; role-permission + p rows update transactionally and reach holders right away.
  • Missing direct or indirect permission dependencies are rejected with 400 listing them; the server does not add dependencies (depends on Implementation: Permission dependencies mapping via Yaml extensibility #560).
  • Any edit, including a permissions-only one, updates updated_at.
  • Non-staff users get 403; static roles return 400; unknown or removed roles return 404.
  • Audit trail follows separately (Implementation: Custom roles audit trail #588).

Activity

  1. added
    willow
    on Oct 30, 2026
  2. rodmgwgu commented on Nov 5, 2026

    @rodmgwgu
    ContributorAuthor

    Under discussion: the draft Custom Roles API ADR for #469 (ADR 0036, not merged yet) proposes changes that affect this ticket. Nothing is final until the ADR is approved.

    Proposed changes:

    • No server-side dependency closure. A PATCH whose permissions leave out a dependency, or remove one another permission still needs, is rejected with a 400 that lists the missing permissions. The client handles selection using the catalog's depends_on lists.
    • A taken name returns 409. Names are unique among all roles, ignoring case.
    • One endpoint for both updates. PATCH /api/authz/v1/roles/<role>/ accepts display_name, description and permissions. permissions replaces the full list.
    • Editing a static role returns 400.
    • updated_at changes on every edit, including permissions-only edits.
  3. self-assigned this
    on Nov 23, 2026
  4. moved this to In Progress in RBAC AuthZ Boardon Nov 23, 2026
  5. moved this from In Progress to Ready for Review in RBAC AuthZ Boardon Nov 24, 2026
  6. moved this from Ready for Review to In Review in RBAC AuthZ Boardon Nov 24, 2026
  7. moved this from In Review to Done in RBAC AuthZ Boardon Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

willow

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions