Skip to content

chore: remove UpsertCustomRole in favor of Insert + Update #14217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
Emyrk committed Aug 13, 2024
commit b49b713a6eb8a4dc16311bf6f762661f734e6714
4 changes: 2 additions & 2 deletions enterprise/cli/organizationmembers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestEnterpriseListOrganizationMembers(t *testing.T) {

ctx := testutil.Context(t, testutil.WaitMedium)
//nolint:gocritic // only owners can patch roles
customRole, err := ownerClient.PatchOrganizationRole(ctx, codersdk.Role{
customRole, err := ownerClient.CreateOrganizationRole(ctx, codersdk.Role{
Name: "custom",
OrganizationID: owner.OrganizationID.String(),
DisplayName: "Custom Role",
Expand Down Expand Up @@ -147,7 +147,7 @@ func TestAssignOrganizationMemberRole(t *testing.T) {

ctx := testutil.Context(t, testutil.WaitMedium)
// nolint:gocritic // requires owner role to create
customRole, err := ownerClient.PatchOrganizationRole(ctx, codersdk.Role{
customRole, err := ownerClient.CreateOrganizationRole(ctx, codersdk.Role{
Name: "custom-role",
OrganizationID: owner.OrganizationID.String(),
DisplayName: "Custom Role",
Expand Down
2 changes: 1 addition & 1 deletion enterprise/cli/templatecreate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func TestTemplateCreate(t *testing.T) {
ctx := testutil.Context(t, testutil.WaitMedium)

//nolint:gocritic // owner required to make custom roles
orgTemplateAdminRole, err := ownerClient.PatchOrganizationRole(ctx, codersdk.Role{
orgTemplateAdminRole, err := ownerClient.CreateOrganizationRole(ctx, codersdk.Role{
Name: "org-template-admin",
OrganizationID: secondOrg.ID.String(),
OrganizationPermissions: codersdk.CreatePermissions(map[codersdk.RBACResource][]codersdk.RBACAction{
Expand Down
2 changes: 1 addition & 1 deletion enterprise/coderd/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ func TestTemplates(t *testing.T) {
})

//nolint:gocritic // owner required to make custom roles
orgTemplateAdminRole, err := ownerClient.PatchOrganizationRole(ctx, codersdk.Role{
orgTemplateAdminRole, err := ownerClient.CreateOrganizationRole(ctx, codersdk.Role{
Name: "org-template-admin",
OrganizationID: secondOrg.ID.String(),
OrganizationPermissions: codersdk.CreatePermissions(map[codersdk.RBACResource][]codersdk.RBACAction{
Expand Down
2 changes: 1 addition & 1 deletion enterprise/coderd/userauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ func TestEnterpriseUserLogin(t *testing.T) {

ctx := testutil.Context(t, testutil.WaitShort)
//nolint:gocritic // owner required
customRole, err := ownerClient.PatchOrganizationRole(ctx, codersdk.Role{
customRole, err := ownerClient.CreateOrganizationRole(ctx, codersdk.Role{
Name: "custom-role",
OrganizationID: owner.OrganizationID.String(),
OrganizationPermissions: []codersdk.Permission{},
Expand Down
2 changes: 1 addition & 1 deletion enterprise/coderd/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func TestAssignCustomOrgRoles(t *testing.T) {

ctx := testutil.Context(t, testutil.WaitShort)
// Create a custom role as an organization admin that allows making templates.
auditorRole, err := client.PatchOrganizationRole(ctx, codersdk.Role{
auditorRole, err := client.CreateOrganizationRole(ctx, codersdk.Role{
Name: "org-template-admin",
OrganizationID: owner.OrganizationID.String(),
DisplayName: "Template Admin",
Expand Down
4 changes: 3 additions & 1 deletion site/src/api/rbacresources_gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ export const RBACResourceActions: Partial<
},
assign_org_role: {
assign: "ability to assign org scoped roles",
create: "ability to create/delete/edit custom roles within an organization",
create: "ability to create/delete custom roles within an organization",
delete: "ability to delete org scoped roles",
read: "view what roles are assignable",
update: "ability to edit custom roles within an organization",
},
assign_role: {
assign: "ability to assign roles",
create: "ability to create/delete/edit custom roles",
delete: "ability to unassign roles",
read: "view what roles are assignable",
update: "ability to edit custom roles",
},
audit_log: {
create: "create new audit log entries",
Expand Down