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
606cf5d6
Commit
606cf5d6
authored
Sep 25, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code and add filter logic to group sync
parent
de07a7a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
app/models/ldap_group_link.rb
app/models/ldap_group_link.rb
+4
-4
ee/lib/ee/gitlab/ldap/sync/group.rb
ee/lib/ee/gitlab/ldap/sync/group.rb
+5
-1
No files found.
app/models/ldap_group_link.rb
View file @
606cf5d6
...
...
@@ -2,7 +2,7 @@ class LdapGroupLink < ActiveRecord::Base
include
Gitlab
::
Access
belongs_to
:group
NIL
_ATTRIBUTES
=
%w[cn filter]
.
freeze
BLANK
_ATTRIBUTES
=
%w[cn filter]
.
freeze
validates
:cn
,
:group_access
,
:group_id
,
presence:
true
,
unless: :filter
validates
:cn
,
uniqueness:
{
scope:
[
:group_id
,
:provider
]
},
unless: :filter
...
...
@@ -14,7 +14,7 @@ class LdapGroupLink < ActiveRecord::Base
scope
:with_provider
,
->
(
provider
)
{
where
(
provider:
provider
)
}
before_save
:
update
_blank_attributes
before_save
:
nullify
_blank_attributes
def
access_field
group_access
...
...
@@ -37,7 +37,7 @@ class LdapGroupLink < ActiveRecord::Base
private
def
update
_blank_attributes
NIL
_ATTRIBUTES
.
each
{
|
attr
|
self
[
attr
]
=
nil
if
self
[
attr
].
blank?
}
def
nullify
_blank_attributes
BLANK
_ATTRIBUTES
.
each
{
|
attr
|
self
[
attr
]
=
nil
if
self
[
attr
].
blank?
}
end
end
ee/lib/ee/gitlab/ldap/sync/group.rb
View file @
606cf5d6
...
...
@@ -74,7 +74,7 @@ module EE
access_levels
=
AccessLevels
.
new
# Only iterate over group links for the current provider
group
.
ldap_group_links
.
with_provider
(
provider
).
each
do
|
group_link
|
if
member_dns
=
dns_for_group_cn
(
group_link
.
cn
)
if
member_dns
=
get_member_dns
(
group_link
)
access_levels
.
set
(
member_dns
,
to:
group_link
.
group_access
)
logger
.
debug
do
"Resolved '
#{
group
.
name
}
' group member access:
#{
access_levels
.
to_hash
}
"
...
...
@@ -88,6 +88,10 @@ module EE
private
def
get_member_dns
(
group_link
)
group_link
.
cn
?
dns_for_group_cn
(
group_link
.
cn
)
:
UserFilter
.
filter
(
@proxy
,
group_link
.
filter
)
end
def
dns_for_group_cn
(
group_cn
)
proxy
.
dns_for_group_cn
(
group_cn
)
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