Skip to content

Make audit access a role option (opt-in for custom roles) - #322

Merged
KilianBoute merged 5 commits into
mainfrom
feat/admin-audit-access
Nov 6, 2026
Merged

KilianBoute merged 5 commits into
mainfrom
feat/admin-audit-access

Conversation

@KilianBoute

Copy link
Copy Markdown
Member

What

  • The legacy admin tier (built-in admin and custom roles on the admin parent) always holds audit.read and pages.audit. Neither has a legacy page key, so admins hold them whatever their page list says.
  • audit.read and pages.audit are no longer OwnerOnly. OwnerOnly lists what the legacy admin tier never had, and admins now have audit access, so delegated administrators may grant it.
  • System roles are unchanged. Organisation manager still does not read audit history.

Why

Admins should be able to open the Audit events page by default. hub-api builds the profile's access.permissions from this mapping, and the frontend shows the page only when pages.audit is present.

Tests

go test ./pkg/... passes. The pinned legacy admin sets and the owner-only list are updated.

Consumers: hub-api (role check plus a models bump after release) and hub-frontend (route, navigation, alert audit button).

🤖 Generated with Claude Code

The legacy admin tier now always holds audit.read and pages.audit, and
both are no longer owner-only, so delegated administrators may grant them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KilianBoute

Copy link
Copy Markdown
Member Author

Rollout order: #322 → models release → bump models in hub-api#728 → merge hub-api#728 + hub-frontend#955. Admins see the Audit page only once the profile carries pages.audit (from the models legacy admin mapping).

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The audit page key grants pages.audit and audit.read. The built-in admin
tier is served it; custom roles on the guest and editor tiers may list it
(legacyTierOptionalPages) without the built-in tiers getting it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KilianBoute KilianBoute changed the title Grant the legacy admin tier audit access Make audit access a role option (on by default for the legacy admin tier) Nov 6, 2026
@KilianBoute

Copy link
Copy Markdown
Member Author

Scope extended (b4f8a67): audit is now a legacy page key audit → pages.audit + audit.read. The built-in admin tier is served it (on by default). Custom roles on guest/editor may opt in (legacyTierOptionalPages); custom admin roles keep it only when they list it. Both permissions stay selectable in the RBAC catalog, no longer owner-only. Tests: go test ./pkg/... passes.

Custom admin roles never listed the audit page, so the admin tier holds
pages.audit and audit.read whatever its page list says. Guest and editor
custom roles still opt in with the audit page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KilianBoute KilianBoute changed the title Make audit access a role option (on by default for the legacy admin tier) Make audit access a role option (always on for the legacy admin tier) Nov 6, 2026
@KilianBoute

Copy link
Copy Markdown
Member Author

Decision 11-06: audit is always on for the admin tier (built-in and custom: custom admin roles never listed the audit page, so no migration). Guest/editor custom roles opt in with the audit page. Role editor shows it ticked + locked for admin-tier roles and doesn't store it. (d5f06b4)

Admin-tier custom roles hold the audit page unless LegacyRole.DisabledPages
lists it, also roles created before the page existed. LegacyCustomRolePages
is the one rule the access mapping and the user middleware share.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KilianBoute

Copy link
Copy Markdown
Member Author

Update (882c7d2 / 544cbb59 / cd561c0d): audit is on by default for admin-based roles and switchable per role. Roles get a disabledPages field; an untick saves disabledPages: ["audit"], re-ticking clears it. Existing admin custom roles (no field) get audit. Guest/editor roles opt in via the audit page. One rule, models.LegacyCustomRolePages, feeds both the access mapping and the hub-api user middlewares. hub-api#728 now calls that function, so its CI needs the models release + bump first.

@KilianBoute KilianBoute changed the title Make audit access a role option (always on for the legacy admin tier) Make audit access a role option (on by default for admin roles) Nov 6, 2026
Custom roles on the admin tier hold the audit page only when they list it,
like guest and editor roles. Drops LegacyCustomRolePages and
LegacyRole.DisabledPages; the built-in admin tier still serves it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KilianBoute KilianBoute changed the title Make audit access a role option (on by default for admin roles) Make audit access a role option (opt-in for custom roles) Nov 6, 2026
@KilianBoute

Copy link
Copy Markdown
Member Author

Changed on 2026-11-06: audit is now opt-in for every custom role, admin-based ones included. It is unticked by default and a role holds it only when its page list contains audit. The built-in Admin role keeps it.

The default-on mechanism is gone (disabledPages, LegacyCustomRolePages).

Commit 8a08d33.

@KilianBoute
KilianBoute merged commit 7253698 into main Nov 6, 2026
5 checks passed
@KilianBoute
KilianBoute deleted the feat/admin-audit-access branch November 6, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant