Skip to content

feat: Add clerk_organization & clerk_organization_id helpers#22

Merged
agis merged 1 commit intomainfrom
org-id
Nov 2, 2022
Merged

feat: Add clerk_organization & clerk_organization_id helpers#22
agis merged 1 commit intomainfrom
org-id

Conversation

@agis
Copy link
Copy Markdown
Member

@agis agis commented Nov 2, 2022

This fetches the organization ID of the currently authenticated session, if any. Otherwise it returns nil.

Copy link
Copy Markdown
Contributor

@SokratisVidros SokratisVidros left a comment

Choose a reason for hiding this comment

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

What about clerk_organization?

@agis
Copy link
Copy Markdown
Member Author

agis commented Nov 2, 2022

What about clerk_organization?

Thought about that, but it would be inconsistent with the other helpers. We currently have:

  • clerk_user which returns a User object
  • clerk_user_id which returns the User's ID

Following that same convention, it made sense for it to be suffixed with _id since it returns an ID.

Then, I chose org over organization for convenience/brevity. Do you think we should change it to clerk_organization_id?

@SokratisVidros
Copy link
Copy Markdown
Contributor

That's right. I am suggesting to have both, clerk_organization should return the full clerk_organization object.

@agis
Copy link
Copy Markdown
Member Author

agis commented Nov 2, 2022

Overhauled this to introduce two new helpers:

  • clerk_organization does a BAPI call to fetch the organization object, if any
  • clerk_organization_id returns the org ID (if any) by merely peeking at the session token

@SokratisVidros PTAL.

@agis agis requested a review from SokratisVidros November 2, 2022 11:48
@agis agis changed the title feat: Add clerk_org_id helper method feat: Add clerk_organization & clerk_organization_id helpers Nov 2, 2022
Copy link
Copy Markdown
Contributor

@SokratisVidros SokratisVidros left a comment

Choose a reason for hiding this comment

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

💯

@agis agis merged commit 800a78b into main Nov 2, 2022
@agis agis deleted the org-id branch November 2, 2022 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants