(role codersdk.WorkspaceRole)
| 954 | } |
| 955 | |
| 956 | func 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 | |
| 979 | func ChatRoleActions(role codersdk.ChatRole) []policy.Action { |
| 980 | if role == codersdk.ChatRoleRead { |
no test coverage detected