Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7ba37d86
Commit
7ba37d86
authored
Jul 31, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gitlab::LDAP - ability to collect group members
parent
1e9b2733
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
lib/gitlab/ldap/adapter.rb
lib/gitlab/ldap/adapter.rb
+6
-2
lib/gitlab/ldap/group.rb
lib/gitlab/ldap/group.rb
+23
-3
No files found.
lib/gitlab/ldap/adapter.rb
View file @
7ba37d86
...
...
@@ -54,10 +54,10 @@ module Gitlab
end
end
def
users
(
cn
=
"*"
)
def
users
(
uid
=
"*"
)
options
=
{
base:
config
[
'base'
],
filter:
Net
::
LDAP
::
Filter
.
eq
(
"
cn"
,
cn
)
filter:
Net
::
LDAP
::
Filter
.
eq
(
"
uid"
,
uid
)
}
entries
=
ldap
.
search
(
options
).
select
do
|
entry
|
...
...
@@ -69,6 +69,10 @@ module Gitlab
end
end
def
user
(
uid
)
users
(
uid
).
first
end
private
def
config
...
...
lib/gitlab/ldap/group.rb
View file @
7ba37d86
...
...
@@ -26,8 +26,26 @@ module Gitlab
end
def
members
member_uids
.
map
do
|
uid
|
adapter
.
user
(
uid
)
end
.
compact
end
private
def
member_uids
if
entry
.
respond_to?
:memberuid
entry
.
memberuid
else
member_dns
.
map
do
|
dn
|
$1
if
dn
=~
/uid=([a-zA-Z0-9.-]+)/
end
end
.
compact
end
def
member_dns
if
entry
.
respond_to?
:member
entry
.
meber
entry
.
me
m
ber
elsif
entry
.
respond_to?
:uniquemember
entry
.
uniquemember
elsif
entry
.
respond_to?
:memberof
...
...
@@ -37,11 +55,13 @@ module Gitlab
end
end
private
def
entry
@entry
end
def
adapter
@adapter
||=
Gitlab
::
LDAP
::
Adapter
.
new
end
end
end
end
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