@@ -584,12 +584,12 @@ func (q *querier) authorizeUpdateFileTemplate(ctx context.Context, file database
584
584
585
585
// uniqueOrganizationRoles converts a set of scoped role names to their unique
586
586
// scoped names.
587
- func (q * querier ) uniqueOrganizationRoles (organizationID uuid.UUID , names []string ) ([]rbac.UniqueRoleName , error ) {
588
- uniques := make ([]rbac.UniqueRoleName , 0 , len (names ))
587
+ func (q * querier ) uniqueOrganizationRoles (organizationID uuid.UUID , names []string ) ([]rbac.RoleName , error ) {
588
+ uniques := make ([]rbac.RoleName , 0 , len (names ))
589
589
for _ , name := range names {
590
590
// This check is a developer safety check. Old code might try to invoke this code path with
591
591
// organization id suffixes. Catch this and return a nice error so it can be fixed.
592
- _ , foundOrg , _ := rbac .RoleSplit (rbac .UniqueRoleName (name ))
592
+ _ , foundOrg , _ := rbac .RoleSplit (rbac .RoleName (name ))
593
593
if foundOrg != "" {
594
594
return nil , xerrors .Errorf ("attempt to assign a role %q, remove the ':<organization_id> suffix" , name )
595
595
}
@@ -601,7 +601,7 @@ func (q *querier) uniqueOrganizationRoles(organizationID uuid.UUID, names []stri
601
601
}
602
602
603
603
// canAssignRoles handles assigning built in and custom roles.
604
- func (q * querier ) canAssignRoles (ctx context.Context , orgID * uuid.UUID , added , removed []rbac.UniqueRoleName ) error {
604
+ func (q * querier ) canAssignRoles (ctx context.Context , orgID * uuid.UUID , added , removed []rbac.RoleName ) error {
605
605
actor , ok := ActorFromContext (ctx )
606
606
if ! ok {
607
607
return NoActorError
@@ -615,7 +615,7 @@ func (q *querier) canAssignRoles(ctx context.Context, orgID *uuid.UUID, added, r
615
615
}
616
616
617
617
grantedRoles := append (added , removed ... )
618
- customRoles := make ([]rbac.UniqueRoleName , 0 )
618
+ customRoles := make ([]rbac.RoleName , 0 )
619
619
// Validate that the roles being assigned are valid.
620
620
for _ , r := range grantedRoles {
621
621
roleOrgIDStr , isOrgRole := rbac .IsOrgRole (r )
@@ -647,7 +647,7 @@ func (q *querier) canAssignRoles(ctx context.Context, orgID *uuid.UUID, added, r
647
647
}
648
648
}
649
649
650
- customRolesMap := make (map [rbac.UniqueRoleName ]struct {}, len (customRoles ))
650
+ customRolesMap := make (map [rbac.RoleName ]struct {}, len (customRoles ))
651
651
for _ , r := range customRoles {
652
652
customRolesMap [r ] = struct {}{}
653
653
}
@@ -2867,7 +2867,7 @@ func (q *querier) UpdateMemberRoles(ctx context.Context, arg database.UpdateMemb
2867
2867
2868
2868
// The 'rbac' package expects role names to be scoped.
2869
2869
// Convert the argument roles for validation.
2870
- scopedGranted := make ([]rbac.UniqueRoleName , 0 , len (arg .GrantedRoles ))
2870
+ scopedGranted := make ([]rbac.RoleName , 0 , len (arg .GrantedRoles ))
2871
2871
for _ , grantedRole := range arg .GrantedRoles {
2872
2872
// This check is a developer safety check. Old code might try to invoke this code path with
2873
2873
// organization id suffixes. Catch this and return a nice error so it can be fixed.
0 commit comments