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
Jérome Perrin
gitlab-ce
Commits
0e9ba0a4
Commit
0e9ba0a4
authored
Sep 08, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add attributes to LDAP::Config.
parent
c915e2c8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
lib/gitlab/ldap/config.rb
lib/gitlab/ldap/config.rb
+4
-0
lib/gitlab/ldap/user.rb
lib/gitlab/ldap/user.rb
+4
-3
spec/lib/gitlab/ldap/user_spec.rb
spec/lib/gitlab/ldap/user_spec.rb
+1
-1
No files found.
config/initializers/1_settings.rb
View file @
0e9ba0a4
...
@@ -97,6 +97,7 @@ if Settings.ldap['enabled'] || Rails.env.test?
...
@@ -97,6 +97,7 @@ if Settings.ldap['enabled'] || Rails.env.test?
server
[
'block_auto_created_users'
]
=
false
if
server
[
'block_auto_created_users'
].
nil?
server
[
'block_auto_created_users'
]
=
false
if
server
[
'block_auto_created_users'
].
nil?
server
[
'allow_username_or_email_login'
]
=
false
if
server
[
'allow_username_or_email_login'
].
nil?
server
[
'allow_username_or_email_login'
]
=
false
if
server
[
'allow_username_or_email_login'
].
nil?
server
[
'active_directory'
]
=
true
if
server
[
'active_directory'
].
nil?
server
[
'active_directory'
]
=
true
if
server
[
'active_directory'
].
nil?
server
[
'attributes'
]
=
{}
if
server
[
'attributes'
].
nil?
server
[
'provider_name'
]
||=
"ldap
#{
key
}
"
.
downcase
server
[
'provider_name'
]
||=
"ldap
#{
key
}
"
.
downcase
server
[
'provider_class'
]
=
OmniAuth
::
Utils
.
camelize
(
server
[
'provider_name'
])
server
[
'provider_class'
]
=
OmniAuth
::
Utils
.
camelize
(
server
[
'provider_name'
])
end
end
...
...
lib/gitlab/ldap/config.rb
View file @
0e9ba0a4
...
@@ -84,6 +84,10 @@ module Gitlab
...
@@ -84,6 +84,10 @@ module Gitlab
options
[
'block_auto_created_users'
]
options
[
'block_auto_created_users'
]
end
end
def
attributes
options
[
'attributes'
]
end
protected
protected
def
base_config
def
base_config
Gitlab
.
config
.
ldap
Gitlab
.
config
.
ldap
...
...
lib/gitlab/ldap/user.rb
View file @
0e9ba0a4
...
@@ -68,12 +68,13 @@ module Gitlab
...
@@ -68,12 +68,13 @@ module Gitlab
Gitlab
::
LDAP
::
Access
.
allowed?
(
gl_user
)
Gitlab
::
LDAP
::
Access
.
allowed?
(
gl_user
)
end
end
def
ldap_config
def
ldap_config
(
provider
=
auth_hash
.
provider
)
Gitlab
::
LDAP
::
Config
.
new
(
auth_hash
.
provider
)
Gitlab
::
LDAP
::
Config
.
new
(
provider
)
end
end
def
auth_hash
=
(
auth_hash
)
def
auth_hash
=
(
auth_hash
)
@auth_hash
=
Gitlab
::
LDAP
::
AuthHash
.
new
(
auth_hash
,
ldap_config
)
config
=
ldap_config
(
auth_hash
.
provider
)
@auth_hash
=
Gitlab
::
LDAP
::
AuthHash
.
new
(
auth_hash
,
config
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/ldap/user_spec.rb
View file @
0e9ba0a4
...
@@ -11,7 +11,7 @@ describe Gitlab::LDAP::User do
...
@@ -11,7 +11,7 @@ describe Gitlab::LDAP::User do
}
}
end
end
let
(
:auth_hash
)
do
let
(
:auth_hash
)
do
double
(
uid:
'my-uid'
,
provider:
'ldapmain'
,
info:
double
(
info
)
)
OmniAuth
::
AuthHash
.
new
(
uid:
'my-uid'
,
provider:
'ldapmain'
,
info:
info
)
end
end
describe
:changed?
do
describe
:changed?
do
...
...
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