Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nextjs,clerk-react,types,clerk-js): Add experimental support for <Gate/> #1942

Merged
merged 8 commits into from
Nov 6, 2023

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Oct 26, 2023

Description

This PR introduces a new public control component called Gate as experimental.

  • <Experimental__Gate/> as client component
  • <Experimental__Gate/> as server component
  • Nexjts auth() function returns the experimental__has in order to check authorization server side
  • @clerk/backend returns the experimental__has function in order to check authorization server side
  • React useAuth() return the experimental__has for checking authorization during SSR or CSR

As of now the component will only support role based check, in the following weeks this will be updated to also support permission based checks which is the pattern we all our customers to use in the future.

This PR will need to backported to v4 as it is complementary to "custom roles & permissions"

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/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@panteliselef panteliselef self-assigned this Oct 26, 2023
@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2023

🦋 Changeset detected

Latest commit: 1a30298

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

This PR includes changesets to release 12 packages
Name Type
@clerk/chrome-extension Minor
@clerk/clerk-js Minor
@clerk/backend Minor
@clerk/nextjs Minor
@clerk/clerk-react Minor
@clerk/types Minor
@clerk/clerk-expo Patch
@clerk/fastify Patch
gatsby-plugin-clerk Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/localizations 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

@dimkl
Copy link
Contributor

dimkl commented Oct 31, 2023

@panteliselef We have changed the process of the v4 hotfixing. Please rebase this PR with main as the base branch and after it's closed, use the backport script to open a hotfix from main-v4.
Also if something that it's not related a fixing an issue in v4 and it can wait until v5, merge it in main and don't backport it.

@dimkl dimkl changed the base branch from main-v4 to release/v4 November 1, 2023 13:22
@LekoArts LekoArts changed the base branch from release/v4 to main November 2, 2023 09:25
@panteliselef panteliselef marked this pull request as ready for review November 2, 2023 14:09
@panteliselef panteliselef requested a review from a team as a code owner November 2, 2023 14:09
Copy link
Member

@tmilewski tmilewski left a comment

Choose a reason for hiding this comment

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

@panteliselef 👍 Nice! Added a few quick comments/questions.

packages/types/src/jwtv2.ts Outdated Show resolved Hide resolved
packages/react/src/hooks/utils.ts Outdated Show resolved Hide resolved
packages/react/src/hooks/utils.ts Outdated Show resolved Hide resolved
@panteliselef panteliselef added this pull request to the merge queue Nov 6, 2023
Merged via the queue into main with commit c7e6d00 Nov 6, 2023
7 checks passed
@panteliselef panteliselef deleted the ORG-280 branch November 6, 2023 10:37
panteliselef added a commit that referenced this pull request Nov 6, 2023
… `<Gate/>` (#1942)

* feat(nextjs,clerk-react,types,clerk-js): Add experimental support for `<Gate/>`

* chore(clerk-js): Remove references to permissions

* fix(clerk-js): Edit internal Gate to use some instead of any

* chore(clerk-js): Enable tests

* chore(clerk-js): Add changeset

* chore(types): Create experimental types

* feat(nextjs): Export `<Experimental__Gate/>`

* chore(chrome-extension): Update snapshot
github-merge-queue bot pushed a commit that referenced this pull request Nov 6, 2023
… `<Gate/>` (#1942) (#2051)

* feat(nextjs,clerk-react,types,clerk-js): Add experimental support for `<Gate/>`

* chore(clerk-js): Remove references to permissions

* fix(clerk-js): Edit internal Gate to use some instead of any

* chore(clerk-js): Enable tests

* chore(clerk-js): Add changeset

* chore(types): Create experimental types

* feat(nextjs): Export `<Experimental__Gate/>`

* chore(chrome-extension): Update snapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants