Skip to content

Commit c567a9d

Browse files
committed
Test updates
1 parent f212ad3 commit c567a9d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

coderd/database/dbauthz/customroles_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func TestInsertCustomRoles(t *testing.T) {
9898
org: codersdk.CreatePermissions(map[codersdk.RBACResource][]codersdk.RBACAction{
9999
codersdk.ResourceWorkspace: {codersdk.ActionRead},
100100
}),
101-
errorContains: "cannot assign both org and site permissions",
101+
errorContains: "organization roles specify site or user permissions",
102102
},
103103
{
104104
name: "invalid-action",

coderd/rbac/roles.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,10 @@ func ReloadBuiltinRoles(opts *RoleOptions) {
340340
Identifier: RoleUserAdmin(),
341341
DisplayName: "User Admin",
342342
Site: Permissions(map[string][]policy.Action{
343-
ResourceAssignRole.Type: {policy.ActionAssign, policy.ActionDelete, policy.ActionRead, policy.ActionUpdate},
343+
ResourceAssignRole.Type: {policy.ActionAssign, policy.ActionDelete, policy.ActionRead},
344344
// Need organization assign as well to create users. At present, creating a user
345345
// will always assign them to some organization.
346-
ResourceAssignOrgRole.Type: {policy.ActionAssign, policy.ActionDelete, policy.ActionRead, policy.ActionUpdate},
346+
ResourceAssignOrgRole.Type: {policy.ActionAssign, policy.ActionDelete, policy.ActionRead},
347347
ResourceUser.Type: {
348348
policy.ActionCreate, policy.ActionRead, policy.ActionUpdate, policy.ActionDelete,
349349
policy.ActionUpdatePersonal, policy.ActionReadPersonal,
@@ -458,7 +458,7 @@ func ReloadBuiltinRoles(opts *RoleOptions) {
458458
Org: map[string][]Permission{
459459
organizationID.String(): Permissions(map[string][]policy.Action{
460460
// Assign, remove, and read roles in the organization.
461-
ResourceAssignOrgRole.Type: {policy.ActionAssign, policy.ActionDelete, policy.ActionRead, policy.ActionUpdate},
461+
ResourceAssignOrgRole.Type: {policy.ActionAssign, policy.ActionDelete, policy.ActionRead},
462462
ResourceOrganizationMember.Type: {policy.ActionCreate, policy.ActionRead, policy.ActionUpdate, policy.ActionDelete},
463463
ResourceGroup.Type: ResourceGroup.AvailableActions(),
464464
}),

coderd/rbac/roles_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func TestRolePermissions(t *testing.T) {
280280
},
281281
{
282282
Name: "CreateCustomRole",
283-
Actions: []policy.Action{policy.ActionCreate},
283+
Actions: []policy.Action{policy.ActionCreate, policy.ActionUpdate},
284284
Resource: rbac.ResourceAssignRole,
285285
AuthorizeMap: map[bool][]hasAuthSubjects{
286286
true: {owner},
@@ -316,7 +316,7 @@ func TestRolePermissions(t *testing.T) {
316316
},
317317
{
318318
Name: "CreateOrgRoleAssignment",
319-
Actions: []policy.Action{policy.ActionCreate},
319+
Actions: []policy.Action{policy.ActionCreate, policy.ActionUpdate},
320320
Resource: rbac.ResourceAssignOrgRole.InOrg(orgID),
321321
AuthorizeMap: map[bool][]hasAuthSubjects{
322322
true: {owner, orgAdmin},

0 commit comments

Comments
 (0)