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

Add external Id to organizations in multi-org deployments #1744

Merged
merged 11 commits into from Oct 23, 2023

Conversation

tzjames
Copy link
Collaborator

@tzjames tzjames commented Oct 12, 2023

Features and Changes

For multi-org, companies might want to manage their organizations via our API and hence will need to keep track of the organizations by their own referenceId.

  • Adds referenceId to model
  • Updates API endpoints to take referenceId when creating and return it in results
  • Adds new API endpoint for modifying
  • Updates Creation via UI to optionally take the referenceId
  • Adds edit button and modal in UI to update the name and the referenceId
  • Adds a field on the general settings page for referenceId if it is !isCloud() && isMultiOrg
  • Allows super users to have all permissions on behalf of all organizations.

Testing

UI:
go to /admin
see the external ID column
add new organization
see the new field to insert an external Id
fill out the form and save
see the externalId populated in the column.

API:
Using the Personal Access Token of a superAdmin.

curl -X POST http://localhost:3100/api/v1/organizations \
  -d 'name=My subsidiary 5' \
-d 'referenceId=external-api'\
  -u secret_user_A0eA8VImVQfTwFE6aLmvRnrxGHjcDZKqkz3JY2Wo:

See the referenceId is in the result returned.

curl -X PUT http://localhost:3100/api/v1/organizations/org_19exnt16m6lno9dr53 \
 -d 'name=My subsidiary new' \
 -d 'referenceId=external-api-2'\
  -u secret_user_pVs1l6BTuduOfrCciASj22gBcJxI6gVuexEjzG0WY:

See the new org is returned with referenceId set.

curl  http://localhost:3100/api/v1/organizations \       
 -u secret_user_A0eA8VImVQfTwFE6aLmvRnrxGHjcDZKqkz3JY2Wo:

See all the organizations with the referenceId field populated for the organizations that have it.

Screenshots

Screenshot 2023-10-13 at 2 49 24 PM Screenshot 2023-10-13 at 2 49 13 PM Screenshot 2023-10-13 at 2 48 51 PM Screenshot 2023-10-13 at 2 48 39 PM Screenshot 2023-10-13 at 2 48 30 PM

@github-actions
Copy link

github-actions bot commented Oct 12, 2023

Deploy preview for docs ready!

✅ Preview
https://docs-1w3t2zzaz-growthbook.vercel.app

Built with commit d4fd9a7.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link

github-actions bot commented Oct 12, 2023

Your preview environment pr-1744-bttf has been deployed.

Preview environment endpoints are available at:

@jdorn jdorn changed the title Add externalId to organizations Add external Id to organizations in multi-org deployments Oct 13, 2023
@tzjames tzjames requested a review from jdorn October 19, 2023 12:36
@tzjames tzjames merged commit b0eb4bc into main Oct 23, 2023
5 checks passed
@tzjames tzjames deleted the ji/external-org-id branch October 23, 2023 08:40
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.

None yet

2 participants