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:
Selene
2022-02-01 12:03:21 +01:00
committed by GitHub
parent 8b2fe460e2
commit 875e0736ec
7 changed files with 31 additions and 20 deletions

View File

@ -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)
}