Repository navigation
fix(frontend): read the org role from the token for shared saved views (#702) - #1500
Merged
Merged
Conversation
#702) Signed-off-by: alex-dembele <alexandredembele16@gmail.com>
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.
Closes #702
Owners and admins were shown a member's interface for shared saved views because the gate read the legacy
user.role. That field is empty for every sign-up account. The org role of the active organisation now has a single reader,frontend/src/lib/orgRole.ts, built from the token'sorg_roles[tenant_id].hasRole, the saved-views gate and the sidebar role label all use it. The risk-weights screen was already fixed by #867; its test now uses the real store, with root, admin and member, instead of a stubbedhasRole.Verification
npx tsc -b --noEmit→ exit 0npx eslintandnpx prettier --checkon the 7 touched files → cleannpx vitest run(full) → 1443/1444 passed. The one failure,src/__tests__/App.integration.test.tsx, is a timeout under full-suite load; run alone it passes 2/2 (3/3 tests). Not touched by this diff.useTableState.ts(3 failed: root, admin, member-with-legacy-admin) and pass with the fix.root, legacyroleempty) plus an invited admin and an invited member (business roleauditor):/risks/weighting)PUT /risk-scoring/weights200 for root and admin, 403 for member;PATCH /saved-views/:idof a colleague's view 200 for admin, 403 for member.org_roleswith one entry, the active org.Review
org_rolesentry are not exploitable today, because every token carries one entry. Hardening is tracked in Role gates read every org_roles entry instead of the active tenant's #1499.Not done
hasRolestill accepts the legacyuser.roleandbusiness_rolefor other screens. This is cosmetic, because the server refuses, and it is out of scope here.