Repository navigation
feat(utils): add resolvePriorityRole for picking one role by priority - #927
anetasliwinska wants to merge 1 commit into
Conversation
Identity providers hand back every role a token carries with no ordering guarantee, but many CMS-driven UIs need exactly one role per user to pick a label or a form option. This implements only the ordering - given a priority-ordered list and a fallback, it returns the first role the user actually holds. The role vocabulary itself stays the caller's concern, so each project can pass its own role names and fallback.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. WalkthroughThe change adds and exports a generic ChangesPriority role helper
Local Node configuration
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to This PR adds the priority-role helper and its tests without an identified merge-blocking behavior change. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. I sort the roles from high to low, Comment |
Coverage Report for packages/configs/vitest-config
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Summary
resolvePriorityRoleto@o2s/utils.api-harmonization: given a priority-ordered list of roles and a fallback, returns the first role the user actually holds.Test plan
roles.spec.ts): priority order, order-independence of the input roles, fallback to lower-priority role, fallback to default, missing roles list.npm run lintandnpm run testpass for@o2s/utils.api-harmonization.Summary by CodeRabbit
New Features
Tests
Chores