Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
feae4c6c
Commit
feae4c6c
authored
Sep 21, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ldap): fixed syncing of email and name from ldap, fixes #2765
parent
fb767f56
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
pkg/login/ldap.go
+19
-0
No files found.
pkg/login/ldap.go
View file @
feae4c6c
...
...
@@ -68,6 +68,10 @@ func (a *ldapAuther) login(query *LoginUserQuery) error {
if
grafanaUser
,
err
:=
a
.
getGrafanaUserFor
(
ldapUser
);
err
!=
nil
{
return
err
}
else
{
// sync user details
if
err
:=
a
.
syncUserInfo
(
grafanaUser
,
ldapUser
);
err
!=
nil
{
return
err
}
// sync org roles
if
err
:=
a
.
syncOrgRoles
(
grafanaUser
,
ldapUser
);
err
!=
nil
{
return
err
...
...
@@ -122,6 +126,21 @@ func (a *ldapAuther) createGrafanaUser(ldapUser *ldapUserInfo) (*m.User, error)
return
&
cmd
.
Result
,
nil
}
func
(
a
*
ldapAuther
)
syncUserInfo
(
user
*
m
.
User
,
ldapUser
*
ldapUserInfo
)
error
{
var
name
=
fmt
.
Sprintf
(
"%s %s"
,
ldapUser
.
FirstName
,
ldapUser
.
LastName
)
if
user
.
Email
==
ldapUser
.
Email
&&
user
.
Name
==
name
{
return
nil
}
log
.
Info
(
"Ldap: Syncing user info %s"
,
ldapUser
.
Username
)
updateCmd
:=
m
.
UpdateUserCommand
{}
updateCmd
.
UserId
=
user
.
Id
updateCmd
.
Login
=
user
.
Login
updateCmd
.
Email
=
ldapUser
.
Email
updateCmd
.
Name
=
fmt
.
Sprintf
(
"%s %s"
,
ldapUser
.
FirstName
,
ldapUser
.
LastName
)
return
bus
.
Dispatch
(
&
updateCmd
)
}
func
(
a
*
ldapAuther
)
syncOrgRoles
(
user
*
m
.
User
,
ldapUser
*
ldapUserInfo
)
error
{
if
len
(
a
.
server
.
LdapGroups
)
==
0
{
return
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment