diff --git a/conf/defaults.ini b/conf/defaults.ini index eb28892e502..5f9147f83a8 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -128,7 +128,7 @@ allow_org_create = true # Set to true to automatically assign new users to the default organization (id 1) auto_assign_org = true -# Default role new users will be automatically assigned (if disabled above is set to true) +# Default role new users will be automatically assigned (if auto_assign_org above is set to true) auto_assign_org_role = Viewer #################################### Anonymous Auth ########################## diff --git a/pkg/auth/ldap.go b/pkg/auth/ldap.go index 4d7637d6e04..f58f84263a7 100644 --- a/pkg/auth/ldap.go +++ b/pkg/auth/ldap.go @@ -27,7 +27,7 @@ func init() { SearchFilter: "(cn=%s)", SearchBaseDNs: []string{"dc=grafana,dc=org"}, LdapGroups: []*LdapGroupToOrgRole{ - {GroupDN: "cn=users,dc=grafana,dc=org", OrgName: "Main Org.", OrgRole: "Editor"}, + {GroupDN: "cn=users,dc=grafana,dc=org", OrgRole: "Editor"}, }, }, } @@ -77,6 +77,10 @@ func (a *ldapAuther) login(query *AuthenticateUserQuery) error { if grafanaUser, err := a.getGrafanaUserFor(ldapUser); err != nil { return err } else { + // sync org roles + if err := a.syncOrgRoles(grafanaUser, ldapUser); err != nil { + return err + } query.User = grafanaUser return nil } @@ -111,7 +115,6 @@ func (a *ldapAuther) getGrafanaUserFor(ldapUser *ldapUserInfo) (*m.User, error) } func (a *ldapAuther) createGrafanaUser(ldapUser *ldapUserInfo) (*m.User, error) { - cmd := m.CreateUserCommand{ Login: ldapUser.Username, Email: ldapUser.Email, @@ -125,6 +128,10 @@ func (a *ldapAuther) createGrafanaUser(ldapUser *ldapUserInfo) (*m.User, error) return &cmd.Result, nil } +func (a *ldapAuther) syncOrgRoles(user *m.User, ldapUser *ldapUserInfo) error { + return nil +} + func (a *ldapAuther) initialBind(username, userPassword string) error { if a.server.BindPassword != "" { userPassword = a.server.BindPassword diff --git a/pkg/auth/settings.go b/pkg/auth/settings.go index 60f1d4b3db1..2647cac7549 100644 --- a/pkg/auth/settings.go +++ b/pkg/auth/settings.go @@ -3,7 +3,6 @@ package auth type LdapGroupToOrgRole struct { GroupDN string OrgId int - OrgName string OrgRole string }