mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add deployment-wide option to disable workspace sharing (#21172)
Adds `--disable-workspace-sharing` option. Workspace sharing is disabled by not including user and group ACLs in the workspace RBAC object, which prevents ACL-based authz. Closes https://github.com/coder/internal/issues/1072 The commit also adds saving of workspace user/group ACLs in the test DB data generator.
This commit is contained in:
@@ -439,6 +439,16 @@ func Workspace(t testing.TB, db database.Store, orig database.WorkspaceTable) da
|
||||
require.NoError(t, err, "set workspace as dormant")
|
||||
workspace.DormantAt = orig.DormantAt
|
||||
}
|
||||
if len(orig.UserACL) > 0 || len(orig.GroupACL) > 0 {
|
||||
err = db.UpdateWorkspaceACLByID(genCtx, database.UpdateWorkspaceACLByIDParams{
|
||||
ID: workspace.ID,
|
||||
UserACL: orig.UserACL,
|
||||
GroupACL: orig.GroupACL,
|
||||
})
|
||||
require.NoError(t, err, "set workspace ACL")
|
||||
workspace.UserACL = orig.UserACL
|
||||
workspace.GroupACL = orig.GroupACL
|
||||
}
|
||||
return workspace
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user