Skip to content

feat: add prebuilt workspaces to non-default organizations #18010

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

Merged
merged 8 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions coderd/database/dbauthz/dbauthz.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,21 @@ var (
policy.ActionCreate, policy.ActionDelete, policy.ActionRead, policy.ActionUpdate,
policy.ActionWorkspaceStart, policy.ActionWorkspaceStop,
},
// Should be able to add the prebuilds system user as a member to any organization that needs prebuilds.
rbac.ResourceOrganizationMember.Type: {
policy.ActionCreate,
},
Comment on lines +416 to +418
Copy link
Member

Choose a reason for hiding this comment

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

I think you also need read here to determine which organizations the prebuild system user is a member of.

// Needs to be able to assign roles to the system user in order to make it a member of an organization.
rbac.ResourceAssignOrgRole.Type: {
policy.ActionAssign,
},
// Needs to be able to read users to determine which organizations the prebuild system user is a member of.
rbac.ResourceUser.Type: {
policy.ActionRead,
},
rbac.ResourceOrganization.Type: {
policy.ActionRead,
},
}),
},
}),
Expand Down
5 changes: 5 additions & 0 deletions coderd/rbac/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const (
orgUserAdmin string = "organization-user-admin"
orgTemplateAdmin string = "organization-template-admin"
orgWorkspaceCreationBan string = "organization-workspace-creation-ban"

prebuildsOrchestrator string = "prebuilds-orchestrator"
)

func init() {
Expand Down Expand Up @@ -599,6 +601,9 @@ var assignRoles = map[string]map[string]bool{
orgUserAdmin: {
orgMember: true,
},
prebuildsOrchestrator: {
orgMember: true,
},
}

// ExpandableRoles is any type that can be expanded into a []Role. This is implemented
Expand Down
Loading
Loading