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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth: auto assign org id when logging in with ldap #80470
Conversation
Email: id.Email, | ||
Name: id.Name, | ||
IsAdmin: isAdmin, | ||
OrgID: id.OrgID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing it's because we assume the user orgs will be handled in https://github.com/grafana/grafana/blob/63cd5a5625c22dcb5603b10d54228363bcaa70a6/pkg/services/authn/authnimpl/sync/org_sync.go ?
Can't think right now of side effects of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither. But I think we need to set SkipOrgSetup: len(id.OrgRoles) > 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm setting SkipOrgSetup
then the org id won't be auto assigned with the value from the ini file. Maybe we can come up with a better condition here, something like len(id.OrgRoles) > 0 and id is not coming from ldap
, but I don't know if we can do that.
orgID := r.OrgID | ||
if orgID == 0 { | ||
orgID = identity.OrgID | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably break some things, I think orgID = 0
is used in some global contexts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some tests without this part and it seems to be working as well. I think I can remove it and leave only the changes from the s.userService.Create
func parameters from this file.
Closed in favour of #83918. |
What is this feature?
Use AutoAssignOrgId from config as default org.
Why do we need this feature?
[Add a description of the problem the feature is trying to solve.]
Who is this feature for?
[Add information on what kind of user the feature is for.]
Which issue(s) does this PR fix?:
Fixes https://github.com/grafana/support-escalations/issues/8661.
Special notes for your reviewer:
Please check that: