MCPcopy Index your code
hub / github.com/coder/coder / WorkspaceRoleActions

Function WorkspaceRoleActions

coderd/database/db2sdk/db2sdk.go:956–977  ·  view source on GitHub ↗
(role codersdk.WorkspaceRole)

Source from the content-addressed store, hash-verified

954}
955
956func WorkspaceRoleActions(role codersdk.WorkspaceRole) []policy.Action {
957 switch role {
958 case codersdk.WorkspaceRoleAdmin:
959 return slice.Omit(
960 // Small note: This intentionally includes "create" because it's sort of
961 // double purposed as "can edit ACL". That's maybe a bit "incorrect", but
962 // it's what templates do already and we're copying that implementation.
963 rbac.ResourceWorkspace.AvailableActions(),
964 // Don't let anyone delete something they can't recreate.
965 policy.ActionDelete,
966 )
967 case codersdk.WorkspaceRoleUse:
968 return []policy.Action{
969 policy.ActionApplicationConnect,
970 policy.ActionRead,
971 policy.ActionSSH,
972 policy.ActionWorkspaceStart,
973 policy.ActionWorkspaceStop,
974 }
975 }
976 return []policy.Action{}
977}
978
979func ChatRoleActions(role codersdk.ChatRole) []policy.Action {
980 if role == codersdk.ChatRoleRead {

Callers 3

patchWorkspaceACLMethod · 0.92
ValidateRoleMethod · 0.92
convertToWorkspaceRoleFunction · 0.92

Calls 2

OmitFunction · 0.92
AvailableActionsMethod · 0.80

Tested by

no test coverage detected