@@ -646,11 +646,11 @@ func CreateFirstUser(t testing.TB, client *codersdk.Client) codersdk.CreateFirst
646
646
// CreateAnotherUser creates and authenticates a new user.
647
647
// Roles can include org scoped roles with 'roleName:<organization_id>'
648
648
func CreateAnotherUser (t testing.TB , client * codersdk.Client , organizationID uuid.UUID , roles ... rbac.RoleIdentifier ) (* codersdk.Client , codersdk.User ) {
649
- return createAnotherUserRetry (t , client , organizationID , 5 , roles )
649
+ return createAnotherUserRetry (t , client , []uuid. UUID { organizationID } , 5 , roles )
650
650
}
651
651
652
652
func CreateAnotherUserMutators (t testing.TB , client * codersdk.Client , organizationID uuid.UUID , roles []rbac.RoleIdentifier , mutators ... func (r * codersdk.CreateUserRequest )) (* codersdk.Client , codersdk.User ) {
653
- return createAnotherUserRetry (t , client , organizationID , 5 , roles , mutators ... )
653
+ return createAnotherUserRetry (t , client , []uuid. UUID { organizationID } , 5 , roles , mutators ... )
654
654
}
655
655
656
656
// AuthzUserSubject does not include the user's groups.
@@ -676,13 +676,13 @@ func AuthzUserSubject(user codersdk.User, orgID uuid.UUID) rbac.Subject {
676
676
}
677
677
}
678
678
679
- func createAnotherUserRetry (t testing.TB , client * codersdk.Client , organizationID uuid.UUID , retries int , roles []rbac.RoleIdentifier , mutators ... func (r * codersdk.CreateUserRequest )) (* codersdk.Client , codersdk.User ) {
679
+ func createAnotherUserRetry (t testing.TB , client * codersdk.Client , organizationIDs [] uuid.UUID , retries int , roles []rbac.RoleIdentifier , mutators ... func (r * codersdk.CreateUserRequest )) (* codersdk.Client , codersdk.User ) {
680
680
req := codersdk.CreateUserRequest {
681
- Email : namesgenerator .GetRandomName (10 ) + "@coder.com" ,
682
- Username : RandomUsername (t ),
683
- Name : RandomName (t ),
684
- Password : "SomeSecurePassword!" ,
685
- OrganizationID : organizationID ,
681
+ Email : namesgenerator .GetRandomName (10 ) + "@coder.com" ,
682
+ Username : RandomUsername (t ),
683
+ Name : RandomName (t ),
684
+ Password : "SomeSecurePassword!" ,
685
+ OrganizationIDs : organizationIDs ,
686
686
}
687
687
for _ , m := range mutators {
688
688
m (& req )
@@ -694,7 +694,7 @@ func createAnotherUserRetry(t testing.TB, client *codersdk.Client, organizationI
694
694
if err != nil && retries >= 0 && xerrors .As (err , & apiError ) {
695
695
if apiError .StatusCode () == http .StatusConflict {
696
696
retries --
697
- return createAnotherUserRetry (t , client , organizationID , retries , roles )
697
+ return createAnotherUserRetry (t , client , organizationIDs , retries , roles )
698
698
}
699
699
}
700
700
require .NoError (t , err )
@@ -763,8 +763,9 @@ func createAnotherUserRetry(t testing.TB, client *codersdk.Client, organizationI
763
763
require .NoError (t , err , "update site roles" )
764
764
765
765
// isMember keeps track of which orgs the user was added to as a member
766
- isMember := map [uuid.UUID ]bool {
767
- organizationID : true ,
766
+ isMember := make (map [uuid.UUID ]bool )
767
+ for _ , orgID := range organizationIDs {
768
+ isMember [orgID ] = true
768
769
}
769
770
770
771
// Update org roles
0 commit comments