- Notifications
You must be signed in to change notification settings - Fork928
fix: assign new oauth users to default org#12145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
872f4a2
acda012
bf35196
a737111
a075e4c
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1342,14 +1342,16 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C | ||
// with OIDC for the first time. | ||
if user.ID == uuid.Nil { | ||
var organizationID uuid.UUID | ||
// Ignoring this error is a product of our unit tests. In prod this should never | ||
// happen. Unit tests use this as a shortcut to making a new organization. We | ||
// should really fix our unit tests and remove this. | ||
//nolint:gocritic | ||
organization, _ := tx.GetDefaultOrganization(dbauthz.AsSystemRestricted(ctx)) | ||
// Add the user to the default organization. | ||
// Once multi-organization we should check some configuration to see | ||
// if we should add the user to a different organization. | ||
organizationID = organization.ID | ||
Comment on lines +1349 to +1354 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is annoyingly allowed to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Fine not to fix here, but can we add a comment for the ignored err above ( | ||
//nolint:gocritic | ||
_, err := tx.GetUserByEmailOrUsername(dbauthz.AsSystemRestricted(ctx), database.GetUserByEmailOrUsernameParams{ | ||
@@ -1395,7 +1397,7 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C | ||
// All of the userauth tests depend on this being able to create | ||
// the first organization. It shouldn't be possible in normal | ||
// operation. | ||
CreateOrganization:organizationID ==uuid.Nil, | ||
LoginType: params.LoginType, | ||
}) | ||
if err != nil { | ||