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
de07a7a3
Commit
de07a7a3
authored
Sep 25, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ldap group link and add some debug info
parent
a21928d0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
app/models/ldap_group_link.rb
app/models/ldap_group_link.rb
+10
-0
app/views/ldap_group_links/_ldap_group_link.html.haml
app/views/ldap_group_links/_ldap_group_link.html.haml
+1
-1
ee/lib/ee/gitlab/ldap/user_filter.rb
ee/lib/ee/gitlab/ldap/user_filter.rb
+9
-1
No files found.
app/models/ldap_group_link.rb
View file @
de07a7a3
...
...
@@ -2,6 +2,8 @@ class LdapGroupLink < ActiveRecord::Base
include
Gitlab
::
Access
belongs_to
:group
NIL_ATTRIBUTES
=
%w[cn filter]
.
freeze
validates
:cn
,
:group_access
,
:group_id
,
presence:
true
,
unless: :filter
validates
:cn
,
uniqueness:
{
scope:
[
:group_id
,
:provider
]
},
unless: :filter
validates
:filter
,
:group_access
,
:group_id
,
presence:
true
,
unless: :cn
...
...
@@ -12,6 +14,8 @@ class LdapGroupLink < ActiveRecord::Base
scope
:with_provider
,
->
(
provider
)
{
where
(
provider:
provider
)
}
before_save
:update_blank_attributes
def
access_field
group_access
end
...
...
@@ -30,4 +34,10 @@ class LdapGroupLink < ActiveRecord::Base
def
provider_label
config
.
label
end
private
def
update_blank_attributes
NIL_ATTRIBUTES
.
each
{
|
attr
|
self
[
attr
]
=
nil
if
self
[
attr
].
blank?
}
end
end
app/views/ldap_group_links/_ldap_group_link.html.haml
View file @
de07a7a3
...
...
@@ -2,7 +2,7 @@
.pull-right
=
link_to
group_ldap_group_link_path
(
group
,
ldap_group_link
),
method: :delete
,
class:
'btn btn-danger btn-sm'
do
=
fa_icon
(
'unlink'
,
text:
'unlink'
)
%strong
=
ldap_group_link
.
cn
?
"Group:
#{
ldap_group_link
.
cn
}
"
:
"Filter:
#{
ldap_group_link
.
filter
}
"
%strong
=
ldap_group_link
.
cn
?
"Group:
#{
ldap_group_link
.
cn
}
"
:
"Filter:
#{
truncate
(
ldap_group_link
.
filter
,
length:
70
)
}
"
-
if
ldap_group_link
.
config
.light
...
...
ee/lib/ee/gitlab/ldap/user_filter.rb
View file @
de07a7a3
...
...
@@ -12,7 +12,11 @@ module EE
end
def
filter
@proxy
.
adapter
.
ldap_search
(
options
).
map
(
&
:dn
)
logger
.
debug
"Running filter
#{
@filter
}
against
#{
@proxy
.
provider
}
"
@proxy
.
adapter
.
ldap_search
(
options
).
map
(
&
:dn
).
tap
do
|
dns
|
logger
.
debug
"Found
#{
dns
.
count
}
mathing users for filter
#{
@filter
}
"
end
end
private
...
...
@@ -28,6 +32,10 @@ module EE
def
config
@proxy
.
adapter
.
config
end
def
logger
Rails
.
logger
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