feat: add structured policy support with ruleType and params#25
Open
shadrach68 wants to merge 1 commit into
Open
feat: add structured policy support with ruleType and params#25shadrach68 wants to merge 1 commit into
shadrach68 wants to merge 1 commit into
Conversation
Contributor
|
Do resolve conflicts |
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.
Task Summary
This PR replaces the current string-only policy rule model with a structured policy representation. By migrating to a
ruleType+ optional JSONparamsmodel, the policy engine is now equipped to support more advanced parameters (e.g., minimum role sets, expiry grace periods) without making the rule evaluations opaque.Background / Context
Previously,
AccessPolicy.rulewas a fixed string union stored as a plain string in Prisma. This supported simple access scenarios but lacked extensibility for resource-specific constraints. This update preserves backwards compatibility for legacy string rules while establishing the foundation for future structured configuration.Acceptance Criteria
PUBLIC,MEMBERS_ONLY,ADMINS_ONLY, andCONTRIBUTORS_OR_ADMINSrules continue to work.paramsJSON field.DENYdecision.Files / Areas to Change
apps/access-api/prisma/schema.prismaapps/access-api/prisma/seed.tsapps/access-api/prisma/migrations/apps/access-api/src/services/memberService.tspackages/shared-types/src/index.tspackages/policy-engine/src/index.tspackages/policy-engine/test/policy.test.tsTesting Requirements
npm run typecheckpassesnpm run testpasses