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
9f4909fa
Commit
9f4909fa
authored
Nov 28, 2013
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add LDAP check to rake gitlab:check
parent
038b3049
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+36
-0
No files found.
lib/tasks/gitlab/check.rake
View file @
9f4909fa
...
...
@@ -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,41 @@ namespace :gitlab do
end
end
namespace
:ldap
do
task
check: :environment
do
next
unless
ldap_config
.
enabled
warn_user_is_not_gitlab
start_checking
"LDAP"
print_users
finished_checking
"LDAP"
end
def
print_users
puts
'The following LDAP users can log in to your GitLab server:'
ldap
.
search
(
attributes:
attributes
,
filter:
filter
,
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