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
fe41a4e6
Commit
fe41a4e6
authored
Jul 14, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ldap): began work on org role sync
parent
a7b1df34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
conf/defaults.ini
+1
-1
pkg/auth/ldap.go
+9
-2
pkg/auth/settings.go
+0
-1
No files found.
conf/defaults.ini
View file @
fe41a4e6
...
...
@@ -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 ##########################
...
...
pkg/auth/ldap.go
View file @
fe41a4e6
...
...
@@ -27,7 +27,7 @@ func init() {
SearchFilter
:
"(cn=%s)"
,
SearchBaseDNs
:
[]
string
{
"dc=grafana,dc=org"
},
LdapGroups
:
[]
*
LdapGroupToOrgRole
{
{
GroupDN
:
"cn=users,dc=grafana,dc=org"
,
Org
Name
:
"Main Org."
,
Org
Role
:
"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
...
...
pkg/auth/settings.go
View file @
fe41a4e6
...
...
@@ -3,7 +3,6 @@ package auth
type
LdapGroupToOrgRole
struct
{
GroupDN
string
OrgId
int
OrgName
string
OrgRole
string
}
...
...
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