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
6d6c9b78
Commit
6d6c9b78
authored
Aug 01, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ldap): minor fixes, should not have any real impact, #2421
parent
733332a8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
conf/ldap.toml
+1
-1
pkg/login/ldap.go
+2
-1
pkg/login/ldap_test.go
+4
-2
No files found.
conf/ldap.toml
View file @
6d6c9b78
...
...
@@ -36,7 +36,7 @@ org_role = "Admin"
# The Grafana organization database id, optional, if left out the default org (id 1) will be used
# org_id = 1
[[server.group_mappings]]
[[server
s
.group_mappings]]
group_dn
=
"cn=users,dc=grafana,dc=org"
org_role
=
"Editor"
...
...
pkg/login/ldap.go
View file @
6d6c9b78
...
...
@@ -85,11 +85,12 @@ func (a *ldapAuther) getGrafanaUserFor(ldapUser *ldapUserInfo) (*m.User, error)
for
_
,
ldapGroup
:=
range
a
.
server
.
LdapGroups
{
if
ldapUser
.
isMemberOf
(
ldapGroup
.
GroupDN
)
{
access
=
true
break
}
}
if
!
access
{
log
.
Info
(
"Ldap Auth: user %s does not belong in any of the specified ldap groups
"
,
ldapUser
.
Username
)
log
.
Info
(
"Ldap Auth: user %s does not belong in any of the specified ldap groups
, ldapUser groups: %v"
,
ldapUser
.
Username
,
ldapUser
.
MemberOf
)
return
nil
,
ErrInvalidCredentials
}
...
...
pkg/login/ldap_test.go
View file @
6d6c9b78
...
...
@@ -54,7 +54,9 @@ func TestLdapAuther(t *testing.T) {
ldapAutherScenario
(
"Given no existing grafana user"
,
func
(
sc
*
scenarioContext
)
{
ldapAuther
:=
NewLdapAuthenticator
(
&
LdapServerConf
{
LdapGroups
:
[]
*
LdapGroupToOrgRole
{
{
GroupDN
:
"cn=users"
,
OrgRole
:
"Admin"
},
{
GroupDN
:
"cn=admin"
,
OrgRole
:
"Admin"
},
{
GroupDN
:
"cn=editor"
,
OrgRole
:
"Editor"
},
{
GroupDN
:
"*"
,
OrgRole
:
"Viewer"
},
},
})
...
...
@@ -63,7 +65,7 @@ func TestLdapAuther(t *testing.T) {
result
,
err
:=
ldapAuther
.
getGrafanaUserFor
(
&
ldapUserInfo
{
Username
:
"torkelo"
,
Email
:
"my@email.com"
,
MemberOf
:
[]
string
{
"cn=
users
"
},
MemberOf
:
[]
string
{
"cn=
editor
"
},
})
So
(
err
,
ShouldBeNil
)
...
...
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