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
5238efd8
Commit
5238efd8
authored
Aug 29, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only return found LDAP groups for processing
parent
2e21c362
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+1
-1
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+9
-0
No files found.
lib/gitlab/ldap/access.rb
View file @
5238efd8
...
...
@@ -103,7 +103,7 @@ module Gitlab
def
ldap_groups
@ldap_groups
||=
::
LdapGroupLink
.
distinct
(
:cn
).
pluck
(
:cn
).
map
do
|
cn
|
Gitlab
::
LDAP
::
Group
.
find_by_cn
(
cn
,
adapter
)
end
end
.
compact
end
# returns a collection of cn strings to which the user has access
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
5238efd8
...
...
@@ -194,11 +194,20 @@ objectclass: top
objectclass: posixGroup
}
)
end
it
"returns an interator of LDAP Groups"
do
::
LdapGroupLink
.
create
cn:
'example'
,
group_access:
Gitlab
::
Access
::
DEVELOPER
,
group_id:
42
Gitlab
::
LDAP
::
Adapter
.
any_instance
.
stub
(
:group
)
{
Gitlab
::
LDAP
::
Group
.
new
(
ldap_group_1
)
}
expect
(
access
.
ldap_groups
.
first
).
to
be_a
Gitlab
::
LDAP
::
Group
end
it
"only returns found ldap groups"
do
::
LdapGroupLink
.
create
cn:
'example'
,
group_access:
Gitlab
::
Access
::
DEVELOPER
,
group_id:
42
Gitlab
::
LDAP
::
Group
.
stub
(
find_by_cn:
nil
)
# group not found
expect
(
access
.
ldap_groups
).
to
be_empty
end
end
describe
:cns_with_access
do
...
...
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