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

Fix multiorg license report #2315

Merged
merged 3 commits into from Mar 31, 2024
Merged

Fix multiorg license report #2315

merged 3 commits into from Mar 31, 2024

Conversation

tzjames
Copy link
Collaborator

@tzjames tzjames commented Mar 29, 2024

Features and Changes

  • We weren't sending down the license data correctly on the org for companies using the LICENSE_KEY env var, but now are.
  • We weren't correctly showing the license info for companies using the LICENSE_KEY env var, but now are.
  • Updated the license report to separate out invite users and all users, just in case someone is using SCIM and we think the total invites shouldn't be what we count for seats for them - before this we weren't including the invites at all on the report (we were only counting it for non-airgapped licenses)

Testing

set IS_MULTI_ORG=true in both front-end/.env.local and back-end/.env.local
set up growthbook with at least two orgs.
add some duplicate users in both orgs, and some unique.
add some duplicate invites in both orgs, and some unique.
Make sure the current user logged in has superAdmin: true
Go to /admin
Click "Download License Report" button.
Open the json and see something like this - making sure the seatsUsed and activeSeatsUsed matches the number of users and invites.

{
  "license": {
    "id": "11335",
    "companyName": "Universal Paperclips",
    "seats": 100,
    "hardCap": true,
    "dateCreated": "2024-03-29",
    "dateExpires": "2044-06-29",
    "isTrial": false,
    "plan": "enterprise"
  },
  "licenseMetaData": {
    "installationId": "installation-04ed35f0-806c-4ecb-b148-051bc42dd3e1",
    "gitSha": "736b3d4bda1bb7eecd701a754305fabd634a43b6\n",
    "gitCommitDate": "2023-11-14T19:51:59Z\n",
    "sdkLanguages": [
      "nodejs"
    ],
    "dataSourceTypes": [
      "bigquery",
      "postgres"
    ],
    "eventTrackers": [
      "rudderstack",
      "custom"
    ],
    "isCloud": false
  },
  "userEmailCodes": [
    "3b742502",
    "76ad3c40",
    "aa72f161",
    "246a3474",
    "5ba68980",
    "9460c8e6"
  ],
  "inviteEmailCodes": [
    "9a3b4b5d",
    "a556b45d",
    "af9cad30",
    "279748e4",
    "21b19980",
    "76ad3c40",
    "246a3474"
  ],
  "activeSeatsUsed": 6,
  "seatsUsed": 11,
  "signature": "6b08a6e0e749856ae1caaf77c4bbafdcc250979875703e2323ad9fd7f467e56f",
  "timestamp": "2024-03-29T21:07:26.790Z"
}

Screenshots

Copy link

github-actions bot commented Mar 29, 2024

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

Preview environment endpoints are available at:

@@ -35,7 +36,7 @@ const ShowLicenseInfo: FC<{

// TODO: Remove this once we have migrated all organizations to use the license key
const usesLicenseInfoOnModel =
!showUpgradeButton && !organization?.licenseKey;
isCloud() && !showUpgradeButton && !organization?.licenseKey;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if I understand why we need the isCloud() check. Do self-hosted Growthbook orgs not use the license info from the licenses collection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because self hosted orgs can also specify the license in an environmental variable rather than on the mongo organization object. We want to show the license info for them too. Only on cloud and only on old organizations still keeping the license data itself as properties on the organization, do we want to hide the license info, because it would not display correctly. We will be migrating those organizations off in the coming week.

tzjames and others added 2 commits March 30, 2024 14:09
Co-authored-by: Michael Samper <msamper@growthbook.io>
@tzjames tzjames requested a review from msamper March 30, 2024 18:22
@tzjames tzjames merged commit 03e4ae2 into main Mar 31, 2024
3 checks passed
@tzjames tzjames deleted the ji/fix-multiorg-report branch March 31, 2024 19:48
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

3 participants