Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5322f4e

Browse files
committed
fix: new oauth users assigned to default org
1 parent04c6149 commit5322f4e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎coderd/userauth.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,13 +1343,12 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C
13431343
ifuser.ID==uuid.Nil {
13441344
varorganizationID uuid.UUID
13451345
//nolint:gocritic
1346-
organizations,_:=tx.GetOrganizations(dbauthz.AsSystemRestricted(ctx))
1347-
iflen(organizations)>0 {
1348-
// Add the user to the first organization. Once multi-organization
1349-
// support is added, we should enable a configuration map of user
1350-
// email to organization.
1351-
organizationID=organizations[0].ID
1352-
}
1346+
organization,_:=tx.GetDefaultOrganization(dbauthz.AsSystemRestricted(ctx))
1347+
1348+
// Add the user to the default organization.
1349+
// Once multi-organization we should check some configuration to see
1350+
// if we should add the user to a different organization.
1351+
organizationID=organization.ID
13531352

13541353
//nolint:gocritic
13551354
_,err:=tx.GetUserByEmailOrUsername(dbauthz.AsSystemRestricted(ctx), database.GetUserByEmailOrUsernameParams{
@@ -1395,7 +1394,7 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C
13951394
// All of the userauth tests depend on this being able to create
13961395
// the first organization. It shouldn't be possible in normal
13971396
// operation.
1398-
CreateOrganization:len(organizations)==0,
1397+
CreateOrganization:organizationID==uuid.Nil,
13991398
LoginType:params.LoginType,
14001399
})
14011400
iferr!=nil {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp