fix(clerk-js): Hide Members page of OrgProfile if user doesn't have any member related permissions#2138
Conversation
🦋 Changeset detectedLatest commit: ea9e678 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| <OrganizationMembers /> | ||
| <Gate | ||
| some={[{ permission: 'org:sys_memberships:read' }, { permission: 'org:sys_memberships:manage' }]} | ||
| redirectTo='./organization-settings' |
There was a problem hiding this comment.
@anagstef is there a case where the organization-settings path will not exist ? If yes, do you have a proposal on how to handle it ?
There was a problem hiding this comment.
@panteliselef Yes, there is one case. That is when the /organization-settings page is set to be the first in the pages order, then its path is replaced with the root path (/).
I'd say we should handle this one, like we handle similar functionality in the same file.
Something like:
| redirectTo='./organization-settings' | |
| redirectTo={isSettingsPageRoot ? './' : './organization-settings'} |
But let's also test this out that it works!
There was a problem hiding this comment.
Actually i think the correct way is
| redirectTo='./organization-settings' | |
| redirectTo={isSettingsPageRoot ? '../' : './organization-settings'} |
…ny member related permissions
f3008d6 to
ea9e678
Compare
| }); | ||
|
|
||
| // @ts-expect-error | ||
| // @ts-expect-error This property is not typed. It is used by our dashboard in order to render a billing widget. |
| <Gate | ||
| some={[{ permission: 'org:sys_memberships:read' }, { permission: 'org:sys_memberships:manage' }]} | ||
| redirectTo='./organization-settings' | ||
| > | ||
| <OrganizationMembers /> | ||
| </Gate> |
| <OrganizationMembers /> | ||
| <Gate | ||
| some={[{ permission: 'org:sys_memberships:read' }, { permission: 'org:sys_memberships:manage' }]} | ||
| redirectTo='./organization-settings' |
There was a problem hiding this comment.
| redirectTo='./organization-settings' | |
| redirectTo={isSettingsPageRoot ? '../' : './organization-settings'} |
…ny member related permissions (#2138)
…ny member related permissions (#2138) * fix(clerk-js): Hide Members page of OrgProfile if user doesn't have any member related permissions * fix(clerk-js): Address pr comments
Description
This PR hides the members pages if both the "manage" or "read" permissions are missing. In the case of only
org:sys_memberships:manageexisting we display the page but hide the "memberships" tabBefore (only
org:sys_memberships:manage)issue.only.manage.mov
After (only
org:sys_memberships:manage)fixed.only.manage.mov
Before (no permissions)
issue.no.perms.mov
After (no permissions)
fixed.no.perms.mov
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/backend@clerk/chrome-extension@clerk/clerk-js@clerk/clerk-expo@clerk/fastifygatsby-plugin-clerk@clerk/localizations@clerk/nextjs@clerk/clerk-react@clerk/remix@clerk/clerk-sdk-node@clerk/shared@clerk/themes@clerk/typesbuild/tooling/chore