mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 06:02:13 +08:00
LDAP: Use an interface instead of a bus to get group teams (#42165)
* Remove bus for GetTeams for LDAP * Fix lint
This commit is contained in:
@ -311,14 +311,11 @@ func (hs *HTTPServer) GetUserFromLDAP(c *models.ReqContext) response.Response {
|
||||
return response.Error(http.StatusBadRequest, "An organization was not found - Please verify your LDAP configuration", err)
|
||||
}
|
||||
|
||||
cmd := &models.GetTeamsForLDAPGroupCommand{Groups: user.Groups}
|
||||
err = bus.Dispatch(c.Req.Context(), cmd)
|
||||
if err != nil && !errors.Is(err, bus.ErrHandlerNotFound) {
|
||||
u.Teams, err = hs.ldapGroups.GetTeams(user.Groups)
|
||||
if err != nil {
|
||||
return response.Error(http.StatusBadRequest, "Unable to find the teams for this user", err)
|
||||
}
|
||||
|
||||
u.Teams = cmd.Result
|
||||
|
||||
return response.JSON(200, u)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user