Skip to content

Commit ceb52ac

Browse files
authored
fix: user should always belong to an organization (coder#9781)
1 parent d6089ae commit ceb52ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

coderd/users.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,8 +1165,8 @@ func convertUsers(users []database.User, organizationIDsByUserID map[uuid.UUID][
11651165

11661166
func userOrganizationIDs(ctx context.Context, api *API, user database.User) ([]uuid.UUID, error) {
11671167
organizationIDsByMemberIDsRows, err := api.Database.GetOrganizationIDsByMemberIDs(ctx, []uuid.UUID{user.ID})
1168-
if errors.Is(err, sql.ErrNoRows) || len(organizationIDsByMemberIDsRows) == 0 {
1169-
return []uuid.UUID{}, nil
1168+
if errors.Is(err, sql.ErrNoRows) {
1169+
return []uuid.UUID{}, xerrors.Errorf("user %q must be a member of at least one organization", user.Email)
11701170
}
11711171
if err != nil {
11721172
return []uuid.UUID{}, err

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy