Skip to content

Backend: roles catalog search, filter, sort, pagination #569

Closed

Description

@rodmgwgu

Extend GET /api/authz/v1/roles/ (RoleListView) to support the table controls the Roles and Permissions view needs. The catalog shape (roles + permissions + categories per scope_types, ADR 0028 / get_role_catalog) already exists; this is the list-controls layer on top of it.

  • search by role display name;
  • filter by type of resource (the design shows a single "Type of resource" filter; maps to scope_types). The design does not expose a standard-vs-custom filter — the distinction is the per-row "Custom Role" sub-label (definition_kind in the response), so the response must carry definition_kind but a server-side filter on it is optional;
  • sort by role name, type of resource, member count, last updated;
  • pagination (prev/next; response needs a total count for "Showing N of M").

Acceptance

  • New query params documented and validated (400 on bad input, consistent with existing scope-type validation).
  • user_count (members) and modified (last updated) are sortable server-side; the per-role granted-permission count is available for the "Permissions" column.
  • definition_kind (static / user_defined) is present on every role in the response.
  • Authorization unchanged from ADR 0028 (per-resource-type view-team permission).
  • Tests cover each control.

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 details for the list controls:

    • Role fields: each role adds user_count (distinct users, counting only scopes the caller can view, like assignment_count in ADR 0024) and updated_at (null for static roles). The field is updated_at, not modified.
    • Query parameters: search (case-insensitive on display name), sort_by (display_name, scope_type, user_count, updated_at) and order (asc/desc). The names match ADR 0024, and unknown values return 400.
    • Search and sort run in Python: static role names are translated with gettext, so the database can't search or sort them in the user's language. The roles of the requested scope types are loaded, searched, sorted and then paginated. User counts come from one grouped query.
  3. moved this to Ready for Review in RBAC AuthZ Boardon Nov 18, 2026
  4. moved this from Ready for Review to Done in RBAC AuthZ Boardon Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

willow

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions