Skip to content

SPIKE: Typed PermissionId for instance:component:access permissions#5552

Draft
ramonsmits wants to merge 1 commit into
authfrom
auth-typed-permissions
Draft

SPIKE: Typed PermissionId for instance:component:access permissions#5552
ramonsmits wants to merge 1 commit into
authfrom
auth-typed-permissions

Conversation

@ramonsmits

Copy link
Copy Markdown
Member

No description provided.

Introduce a strongly-typed, additive layer over the colon-delimited
authorization permission strings:

- InstanceId / AccessLevel / Component enums (wire value = name lowercased)
- PermissionId readonly record struct with Parse/TryParse/ToString and an
  All catalogue derived from Permissions.All; rejects well-typed but unknown
  triples (e.g. audit:messages:retry)
- PermissionPattern readonly record struct for *:*:view wildcard matching

RolePermissions now expresses its reader/writer patterns as typed
PermissionPattern values and matches via PermissionPattern.Matches, removing
the hand-rolled Split(':') matcher. IsGranted keeps its string signature, so
nothing downstream changes.

The hand-authored const strings in Permissions.cs remain the source of truth
(required by [Authorize(Policy=...)]); a guard test asserts they round-trip
through the typed model and that the two catalogues stay in sync.

Type named PermissionId rather than Permission to satisfy CA1711 (enforced as
error) and to pair with InstanceId.
@ramonsmits ramonsmits removed their assignment Jun 19, 2026
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