Skip to content

Commit

Permalink
fix: Add missing CancelRunAction to WorkspaceWriteRole (#649)
Browse files Browse the repository at this point in the history
We have encountered the issue that a team member with permission to
manage workspace cannot cancel a pending run. This PR adds the missing
`CancelRunAction` to the `WorkspaceWriteRole`.
  • Loading branch information
juanli16 authored Nov 20, 2023
1 parent 7dcb1aa commit 599ddcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/rbac/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var (
name: "write",
permissions: map[Action]bool{
ApplyRunAction: true,
CancelRunAction: true,
LockWorkspaceAction: true,
UnlockWorkspaceAction: true,
CreateWorkspaceVariableAction: true,
Expand Down
3 changes: 3 additions & 0 deletions internal/rbac/role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ func TestRole_IsAllowed(t *testing.T) {
assert.True(t, WorkspacePlanRole.IsAllowed(TailLogsAction))

assert.True(t, WorkspaceWriteRole.IsAllowed(ApplyRunAction))
assert.True(t, WorkspaceWriteRole.IsAllowed(CancelRunAction))
assert.True(t, WorkspaceWriteRole.IsAllowed(CreateRunAction))
assert.True(t, WorkspaceWriteRole.IsAllowed(ListRunsAction))
assert.True(t, WorkspaceWriteRole.IsAllowed(TailLogsAction))

assert.True(t, WorkspaceAdminRole.IsAllowed(SetWorkspacePermissionAction))
assert.True(t, WorkspaceAdminRole.IsAllowed(ApplyRunAction))
assert.True(t, WorkspaceWriteRole.IsAllowed(CancelRunAction))
assert.True(t, WorkspaceAdminRole.IsAllowed(CreateRunAction))
assert.True(t, WorkspaceAdminRole.IsAllowed(ListRunsAction))
assert.True(t, WorkspaceAdminRole.IsAllowed(TailLogsAction))

assert.True(t, WorkspaceManagerRole.IsAllowed(CreateWorkspaceAction))
assert.True(t, WorkspaceManagerRole.IsAllowed(SetWorkspacePermissionAction))
assert.True(t, WorkspaceManagerRole.IsAllowed(ApplyRunAction))
assert.True(t, WorkspaceWriteRole.IsAllowed(CancelRunAction))
assert.True(t, WorkspaceManagerRole.IsAllowed(CreateRunAction))
assert.True(t, WorkspaceManagerRole.IsAllowed(ListRunsAction))
assert.True(t, WorkspaceManagerRole.IsAllowed(TailLogsAction))
Expand Down

0 comments on commit 599ddcb

Please sign in to comment.