-
Notifications
You must be signed in to change notification settings - Fork 205
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce internal Gate component #1834
Conversation
馃 Changeset detectedLatest commit: 3c1a648 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 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 |
@@ -18,6 +19,8 @@ export class OrganizationMembership extends BaseResource implements Organization | |||
publicMetadata: OrganizationMembershipPublicMetadata = {}; | |||
publicUserData!: PublicUserData; | |||
organization!: Organization; | |||
// eslint-disable-next-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: adding (string & {})
allows for getting eslint autocomplete but also accepts any string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we write this in a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call
if (domain) { | ||
setData({ ...domain }); | ||
callbacks?.onSuccess?.({ ...domain }); | ||
if (typeof result !== 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewer: if value is an object then do a shallow copy otherwise use the actual value
da0696a
to
28afb35
Compare
.changeset/loud-foxes-love.md
Outdated
'@clerk/types': patch | ||
--- | ||
|
||
Introduces a new method isAuthorized in the Session class. Returns a promise and checks whether the active user is allowed to perform an action based on the passed (required) permission and the ones attached to the membership. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduces a new method isAuthorized in the Session class. Returns a promise and checks whether the active user is allowed to perform an action based on the passed (required) permission and the ones attached to the membership. | |
Introduces a new `isAuthorized()` method in the `Session` class. Returns a promise and checks whether the active user is allowed to perform an action based on the passed (required) permission and the ones attached to the membership. |
.changeset/proud-dolls-yawn.md
Outdated
'@clerk/clerk-js': patch | ||
--- | ||
|
||
Introduces an internal Gate component (supporting hook and HOC) which enables us to conditionally render parts of our components based on a users permissions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduces an internal Gate component (supporting hook and HOC) which enables us to conditionally render parts of our components based on a users permissions. | |
Introduces an internal `<Gate/>` component (supporting hook and HOC) which enables us to conditionally render parts of our components based on a users permissions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's mark any new permission related types and functions as experimental for now
Description
This PR
isAuthorized
in theSession
class. Returns a promise (future proofing) and checks whether the active user is allowed to perform an action based on the passed (required) permission and the ones attached to the membership.isAdmin
checks)Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
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