mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
fix(enterprise/coderd): skip org membership check for prebuilds user on group patch (#18329)
Currently, the prebuilds documentation states: ``` ### Managing resource quotas Prebuilt workspaces can be used in conjunction with [resource quotas](../../users/quotas.md). Because unclaimed prebuilt workspaces are owned by the `prebuilds` user, you can: 1. Configure quotas for any group that includes this user. 1. Set appropriate limits to balance prebuilt workspace availability with resource constraints. If a quota is exceeded, the prebuilt workspace will fail provisioning the same way other workspaces do. ``` If you need to have a separate quota for prebuilds as opposed to regular users, you are required to create a separate group, as quotas are applied to groups. Currently it is not possible to create a separate 'prebuilds' group with only the prebuilds user to add a quota. This PR skips the org membership check specifically for the prebuilds user when patching a group. 
This commit is contained in:
@ -171,6 +171,12 @@ func (api *API) patchGroup(rw http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
return
|
||||
}
|
||||
// Skip membership checks for the prebuilds user. There is a valid use case
|
||||
// for adding the prebuilds user to a single group: in order to set a quota
|
||||
// allowance specifically for prebuilds.
|
||||
if id == database.PrebuildsSystemUserID.String() {
|
||||
continue
|
||||
}
|
||||
_, err := database.ExpectOne(api.Database.OrganizationMembers(ctx, database.OrganizationMembersParams{
|
||||
OrganizationID: group.OrganizationID,
|
||||
UserID: uuid.MustParse(id),
|
||||
|
Reference in New Issue
Block a user