Skip to content

Commit

Permalink
LDAP: remove unused function (grafana#17351)
Browse files Browse the repository at this point in the history
  • Loading branch information
markelog authored May 29, 2019
1 parent d4ef197 commit a3092dc
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions pkg/services/ldap/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type IConnection interface {
type IServer interface {
Login(*models.LoginUserQuery) (*models.ExternalUserInfo, error)
Users([]string) ([]*models.ExternalUserInfo, error)
ExtractGrafanaUser(*UserInfo) (*models.ExternalUserInfo, error)
InitialBind(string, string) error
Dial() error
Close()
Expand Down Expand Up @@ -148,6 +147,11 @@ func (server *Server) Login(query *models.LoginUserQuery) (

// Check if a second user bind is needed
user := users[0]

if err := server.validateGrafanaUser(user); err != nil {
return nil, err
}

if server.requireSecondBind {
err = server.secondBind(user, query.Password)
if err != nil {
Expand Down Expand Up @@ -188,16 +192,6 @@ func (server *Server) Users(logins []string) (
return serializedUsers, nil
}

// ExtractGrafanaUser extracts external user info from LDAP user
func (server *Server) ExtractGrafanaUser(user *UserInfo) (*models.ExternalUserInfo, error) {
result := server.buildGrafanaUser(user)
if err := server.validateGrafanaUser(result); err != nil {
return nil, err
}

return result, nil
}

// validateGrafanaUser validates user access.
// If there are no ldap group mappings access is true
// otherwise a single group must match
Expand Down

0 comments on commit a3092dc

Please sign in to comment.