SPIKE: Typed PermissionId for instance:component:access permissions#5552
Draft
ramonsmits wants to merge 1 commit into
Draft
SPIKE: Typed PermissionId for instance:component:access permissions#5552ramonsmits wants to merge 1 commit into
ramonsmits wants to merge 1 commit into
Conversation
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.
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.
No description provided.