mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: use default org for PostUser (#12143)
Instead of assuming only 1 org exists, this uses the is_default org to place a user in if not specified.
This commit is contained in:
@@ -1657,6 +1657,18 @@ func (q *FakeQuerier) GetDERPMeshKey(_ context.Context) (string, error) {
|
||||
return q.derpMeshKey, nil
|
||||
}
|
||||
|
||||
func (q *FakeQuerier) GetDefaultOrganization(_ context.Context) (database.Organization, error) {
|
||||
q.mutex.RLock()
|
||||
defer q.mutex.RUnlock()
|
||||
|
||||
for _, org := range q.organizations {
|
||||
if org.IsDefault {
|
||||
return org, nil
|
||||
}
|
||||
}
|
||||
return database.Organization{}, sql.ErrNoRows
|
||||
}
|
||||
|
||||
func (q *FakeQuerier) GetDefaultProxyConfig(_ context.Context) (database.GetDefaultProxyConfigRow, error) {
|
||||
return database.GetDefaultProxyConfigRow{
|
||||
DisplayName: q.defaultProxyDisplayName,
|
||||
|
||||
Reference in New Issue
Block a user