Skip to content

Add resolveGrantDecision permission-resolution helper - #656

Closed
tomek-agent wants to merge 1 commit into
mainfrom
grant-resolution-helper
Closed

Add resolveGrantDecision permission-resolution helper#656
tomek-agent wants to merge 1 commit into
mainfrom
grant-resolution-helper

Conversation

@tomek-agent

Copy link
Copy Markdown

Why

A small reusable helper for a common authorization shape: deciding whether a subject holds a permission on a resource that lives in a containment hierarchy (resource → parent → root), with an optional per-resource opt-out from inheritance.

How

Adds resolveGrantDecision, a pure, dependency-free function. The caller gathers the data (the resource's ancestry, the permissions held keyed by resource, and whether the target opts out of inheritance for the required permission) and this function applies the resolution rule. Keeping the rule separate from data gathering keeps it easy to unit-test and to reuse across different storage and permission models.

Test Plan

Unit tests cover direct grants, inherited grants, a non-matching permission, the inheritance opt-out (both directions), and the empty-ancestry case.

Co-authored-by: tchayen <5769281+tchayen@users.noreply.github.com>
@tomek-agent
tomek-agent force-pushed the grant-resolution-helper branch from 6a40caf to 38eefd7 Compare July 14, 2026 06:34
@tomek-agent

Copy link
Copy Markdown
Author

Closing this. On reflection the helper is decoupled from the framework's abstractions and doesn't earn a public API here; folding it into the consumer for now, and will upstream a genuinely framework-shaped primitive later if one emerges.

@tomek-agent
tomek-agent deleted the grant-resolution-helper branch July 14, 2026 08:03
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