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
9b9925bb
Commit
9b9925bb
authored
Oct 10, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update groups only by own provider
parent
55526227
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
app/models/ldap_group_link.rb
app/models/ldap_group_link.rb
+2
-0
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+4
-2
lib/gitlab/ldap/group.rb
lib/gitlab/ldap/group.rb
+1
-6
No files found.
app/models/ldap_group_link.rb
View file @
9b9925bb
...
...
@@ -6,6 +6,8 @@ class LdapGroupLink < ActiveRecord::Base
validates
:cn
,
uniqueness:
{
scope:
[
:group_id
,
:provider
]
}
validates
:group_access
,
inclusion:
{
in:
Gitlab
::
Access
.
all_values
}
scope
:with_provider
,
->
(
provider
)
{
where
(
provider:
provider
)
}
def
access_field
group_access
end
...
...
lib/gitlab/ldap/access.rb
View file @
9b9925bb
...
...
@@ -133,7 +133,8 @@ module Gitlab
end
def
ldap_groups
@ldap_groups
||=
::
LdapGroupLink
.
distinct
(
:cn
).
pluck
(
:cn
).
map
do
|
cn
|
@ldap_groups
||=
::
LdapGroupLink
.
with_provider
(
provider
)
distinct
(
:cn
).
pluck
(
:cn
).
map
do
|
cn
|
Gitlab
::
LDAP
::
Group
.
find_by_cn
(
cn
,
adapter
)
end
.
compact
end
...
...
@@ -164,7 +165,8 @@ module Gitlab
private
def
gitlab_groups_with_ldap_link
::
Group
.
includes
(
:ldap_group_links
).
references
(
:ldap_group_links
).
where
.
not
(
ldap_group_links:
{
id:
nil
})
where
.
not
(
ldap_group_links:
{
id:
nil
}).
where
(
ldap_group_links:
{
provider:
provider
})
end
# Get the group_access for a give user.
...
...
lib/gitlab/ldap/group.rb
View file @
9b9925bb
module
Gitlab
module
LDAP
class
Group
def
self
.
find_by_cn
(
cn
,
adapter
=
nil
)
adapter
||=
Gitlab
::
LDAP
::
Adapter
.
new
def
self
.
find_by_cn
(
cn
,
adapter
)
adapter
.
group
(
cn
)
end
...
...
@@ -66,10 +65,6 @@ module Gitlab
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