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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
23d180f5
Commit
23d180f5
authored
Dec 04, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ldap_check' of /home/git/repositories/gitlab/gitlabhq
parents
4f067ae9
80302a0f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
config/gitlab.yml.example
config/gitlab.yml.example
+2
-0
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+39
-0
No files found.
config/gitlab.yml.example
View file @
23d180f5
...
...
@@ -114,6 +114,8 @@ production: &base
# ==========================
## LDAP settings
# You can inspect the first 100 LDAP users with login access by running:
# bundle exec rake gitlab:ldap:check[100] RAILS_ENV=production
ldap:
enabled: false
host: '_your_ldap_server'
...
...
lib/tasks/gitlab/check.rake
View file @
23d180f5
...
...
@@ -3,6 +3,7 @@ namespace :gitlab do
task
check:
%w{gitlab:env:check
gitlab:gitlab_shell:check
gitlab:sidekiq:check
gitlab:ldap:check
gitlab:app:check}
...
...
@@ -679,6 +680,44 @@ namespace :gitlab do
end
end
namespace
:ldap
do
task
:check
,
[
:limit
]
=>
:environment
do
|
t
,
args
|
args
.
with_defaults
(
limit:
100
)
warn_user_is_not_gitlab
start_checking
"LDAP"
if
ldap_config
.
enabled
print_users
(
args
.
limit
)
else
puts
'LDAP is disabled in config/gitlab.yml'
end
finished_checking
"LDAP"
end
def
print_users
(
limit
)
puts
"LDAP users with access to your GitLab server (limit:
#{
limit
}
):"
ldap
.
search
(
attributes:
attributes
,
filter:
filter
,
size:
limit
,
return_result:
false
)
do
|
entry
|
puts
"DN:
#{
entry
.
dn
}
\t
#{
ldap_config
.
uid
}
:
#{
entry
[
ldap_config
.
uid
]
}
"
end
end
def
attributes
[
ldap_config
.
uid
]
end
def
filter
Net
::
LDAP
::
Filter
.
present?
(
ldap_config
.
uid
)
end
def
ldap
@ldap
||=
OmniAuth
::
LDAP
::
Adaptor
.
new
(
ldap_config
).
connection
end
def
ldap_config
@ldap_config
||=
Gitlab
.
config
.
ldap
end
end
# Helper methods
##########################
...
...
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