Repository navigation
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
🔀 Cross-SDK feature parityDoes this change need to ship in the other ThunderID SDKs too? This check stays red until one of these labels answers that:
Ports (DO NOT EDIT)
3 of 3 sibling SDKs accounted for. The contract is in the SDK development specification. |
Osara-B
force-pushed
the
hierarchical-permissions
branch
from
November 13, 2026 09:37
6798181 to
70f60ca
Compare
Signed-off-by: Osara-B <osara922@gmail.com>
Osara-B
force-pushed
the
hierarchical-permissions
branch
from
November 16, 2026 06:03
70f60ca to
1e00bf7
Compare
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.
Purpose
ThunderID now supports hierarchical permissions (). A resource server created with
hierarchicalPermissions: truetreats a granted permission as covering the permissions beneath it, e.g.reservationscoversreservations:create. That changes two things the SDK depends on:consent_promptnow carriespermissionDelimiteranddisplayElements, and the server decides each branch by its root's decision. The SDK'sConsentcomponent showed every permission as its own switch, so it could show a child as approved when the server would deny it.This PR updates the SDK to match, without changing behaviour for servers or resource servers that don't use hierarchy.
Approach
Types (
@thunderid/javascript)ConsentPurposeData: adds optionalpermissionDelimiteranddisplayElements.ResourceServerandCreateResourceServerRequest: adds optionalhierarchicalPermissions. It is not added to the update request, because the server doesn't allow changing it after creation.Consent branch view (React and Vue)
getConsentPermissionBranchesgroups a hierarchical purpose into one branch per root. It uses the same delimiter-boundary rule as the server'sPermissionCovers, soorders-archiveis not a child oforders.permissionDelimiter,Consentshows one switch per branch, with the permissions it covers listed read-only beneath it, and a notice that approval also covers permissions added later.consent_decisionsmatch what the server will record.permissionDelimiterrender the same flat list as before.ConsentPermissionBranchListwith achildrencustom render. Vue apps can customise it throughConsent's default slot, usinggetConsentPermissionBranches, which@thunderid/vuenow exports.consent.permissions.subtree_notice, in all 10 shipped locales.Permission checks
hasPermission(granted, required, matching?)takes optional{delimiter, hierarchical}. Without it, the behaviour is unchanged::with hierarchy, matching the built-in System permissions.useGrantedPermissions().can(required, matching?)in React, Vue and Next.js takes the same optional matching, so apps can check their own resource server's permissions. Without it, the behaviour is unchanged, so management checks such ascan('system:group:view')work as before.defineThunderIDMiddlewaregainsscopeMatching.requireScopesstill matches exactly by default. Passing{delimiter: ':'}lets a granted parent satisfy a required child.PermissionMatchingis exported from@thunderid/reactand@thunderid/vue.Compatibility: this PR has no breaking changes. All new fields and options are optional, and the new behaviour only applies when the server sends
permissionDelimiteror the app passes matching options, so the SDK keeps working against servers without hierarchical permissions. If an app setshierarchicalPermissionsagainst an older server, that server ignores the field and creates an exact-match resource server.Related Issues
Related PRs
Checklist
breaking changelabel added.parity/prs-raisedorparity/prs-not-neededadded.parity/prs-raised, the port links are posted as a reply on the parity check's comment.Security checks