Skip to content

Conversation

@panteliselef
Copy link
Member

@panteliselef panteliselef commented Nov 15, 2023

Description

This PR hides the members pages if both the "manage" or "read" permissions are missing. In the case of only org:sys_memberships:manage existing we display the page but hide the "memberships" tab

Before (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 test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/backend
  • @clerk/chrome-extension
  • @clerk/clerk-js
  • @clerk/clerk-expo
  • @clerk/fastify
  • gatsby-plugin-clerk
  • @clerk/localizations
  • @clerk/nextjs
  • @clerk/clerk-react
  • @clerk/remix
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/themes
  • @clerk/types
  • build/tooling/chore

@changeset-bot
Copy link

changeset-bot bot commented Nov 15, 2023

🦋 Changeset detected

Latest commit: ea9e678

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

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'
Copy link
Member Author

@panteliselef panteliselef Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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:

Suggested change
redirectTo='./organization-settings'
redirectTo={isSettingsPageRoot ? './' : './organization-settings'}

But let's also test this out that it works!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually i think the correct way is

Suggested change
redirectTo='./organization-settings'
redirectTo={isSettingsPageRoot ? '../' : './organization-settings'}

@panteliselef panteliselef self-assigned this Nov 17, 2023
@panteliselef panteliselef marked this pull request as ready for review November 17, 2023 11:17
});

// @ts-expect-error
// @ts-expect-error This property is not typed. It is used by our dashboard in order to render a billing widget.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

Comment on lines +132 to +137
<Gate
some={[{ permission: 'org:sys_memberships:read' }, { permission: 'org:sys_memberships:manage' }]}
redirectTo='./organization-settings'
>
<OrganizationMembers />
</Gate>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

<OrganizationMembers />
<Gate
some={[{ permission: 'org:sys_memberships:read' }, { permission: 'org:sys_memberships:manage' }]}
redirectTo='./organization-settings'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
redirectTo='./organization-settings'
redirectTo={isSettingsPageRoot ? '../' : './organization-settings'}

@panteliselef panteliselef added this pull request to the merge queue Nov 22, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 22, 2023
@panteliselef panteliselef added this pull request to the merge queue Nov 22, 2023
Merged via the queue into main with commit 9955938 Nov 22, 2023
@panteliselef panteliselef deleted the elef/core-855-hide-members branch November 22, 2023 10:08
panteliselef added a commit that referenced this pull request Nov 22, 2023
github-merge-queue bot pushed a commit that referenced this pull request Nov 22, 2023
desiprisg pushed a commit that referenced this pull request Nov 23, 2023
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants