Skip to content

chore: scope workspace quotas to organizations#14352

Merged
Emyrk merged 6 commits into
mainfrom
stevenmasley/org_quotas
Aug 21, 2024
Merged

chore: scope workspace quotas to organizations#14352
Emyrk merged 6 commits into
mainfrom
stevenmasley/org_quotas

Conversation

@Emyrk
Copy link
Copy Markdown
Member

@Emyrk Emyrk commented Aug 19, 2024

Quotas are now a function of (user_id, organization_id). They are still sourced from groups. Deprecate the old api endpoint.

Closes #14349

Emyrk added 6 commits August 20, 2024 11:09
Quotas are now a function of (user_id, organization_id). They are
still sourced from groups. Deprecate the old api endpoint.
@Emyrk Emyrk force-pushed the stevenmasley/org_quotas branch from a8ff394 to 61ed7e1 Compare August 20, 2024 16:09
@Emyrk Emyrk requested a review from f0ssel August 20, 2024 17:16
apiKeyMiddleware,
httpmw.ExtractOrganizationParam(api.Database),
// Intentionally using ExtractUser instead of ExtractMember.
// It is possible for a member to be removed from an org, in which
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is fine here, but longer term, is this behavior desirable to administrators? Is there a default dormancy behavior here or any mechanism to clean up these workspaces?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's desirable because the alternative is to forcibly terminate workspaces when a user is removed. A workspace should remain in case:

  1. Removing the user was an accident
  2. There is data in the workspace that is valuable before termination

I think we do have some dormant workspace behavior today to eventually delete this. Ideally there is some page of "orphaned" workspaces an admin could go through and clean these up.

But this PR does not address any of that. It just makes sure the quota api call still works in this case. Otherwise the /{workspace} page would fail to load because of this failed api call.

// defer to the new endpoint using default org as the organization
chi.RouteContext(r.Context()).URLParams.Add("organization", defaultOrg.ID.String())
mw := httpmw.ExtractOrganizationParam(api.Database)
mw(http.HandlerFunc(api.workspaceQuota)).ServeHTTP(rw, r)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Man I wish I could just rip this stuff out 😆

@Emyrk Emyrk merged commit a359879 into main Aug 21, 2024
@Emyrk Emyrk deleted the stevenmasley/org_quotas branch August 21, 2024 14:25
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scope quotas to an organization

2 participants