mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: add agent-connection-watch for workspaces (#24507)
<!-- If you have used AI to produce some or all of this PR, please ensure you have read our [AI Contribution guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) before submitting. --> relates to GRU-18 Adds basic implementation for Workspace Agent Connection Watch and tests. Missing are handling of logs.
This commit is contained in:
@@ -170,6 +170,25 @@ var systemRoles = map[string]permissionsFunc{
|
||||
rbac.RoleOrgServiceAccount(): rbac.OrgServiceAccountPermissions,
|
||||
}
|
||||
|
||||
func TestingGetSystemRole(name string, orgID uuid.UUID, settings rbac.OrgSettings) (rbac.Role, error) {
|
||||
f, ok := systemRoles[name]
|
||||
if !ok {
|
||||
return rbac.Role{}, xerrors.Errorf("role %q not found", name)
|
||||
}
|
||||
perms := f(settings)
|
||||
return rbac.Role{
|
||||
Identifier: rbac.RoleIdentifier{Name: name, OrganizationID: orgID},
|
||||
DisplayName: "",
|
||||
Site: nil,
|
||||
ByOrgID: map[string]rbac.OrgPermissions{
|
||||
orgID.String(): {
|
||||
Org: perms.Org,
|
||||
Member: perms.Member,
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// permissionsFunc produces the desired permissions for a system role
|
||||
// given organization settings.
|
||||
type permissionsFunc func(rbac.OrgSettings) rbac.OrgRolePermissions
|
||||
|
||||
Reference in New Issue
Block a user