Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 0 additions & 3 deletions coderd/database/dbmem/dbmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -3006,9 +3006,6 @@ func (q *FakeQuerier) GetOrganizationIDsByMemberIDs(_ context.Context, ids []uui
OrganizationIDs: userOrganizationIDs,
})
}
if len(getOrganizationIDsByMemberIDRows) == 0 {
return nil, sql.ErrNoRows
}
return getOrganizationIDsByMemberIDRows, nil
}

Expand Down
5 changes: 4 additions & 1 deletion coderd/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -1293,9 +1293,12 @@ func userOrganizationIDs(ctx context.Context, api *API, user database.User) ([]u
if err != nil {
return []uuid.UUID{}, err
}

// If you are in no orgs, then return an empty list.
if len(organizationIDsByMemberIDsRows) == 0 {
return []uuid.UUID{}, xerrors.Errorf("user %q must be a member of at least one organization", user.Email)
return []uuid.UUID{}, nil
}

member := organizationIDsByMemberIDsRows[0]
return member.OrganizationIDs, nil
}
Expand Down
Loading