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
2a49ec57
Commit
2a49ec57
authored
Mar 02, 2018
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing port conflicts
parent
08b45fc9
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
252 additions
and
100 deletions
+252
-100
app/helpers/auth_helper.rb
app/helpers/auth_helper.rb
+0
-3
lib/gitlab/auth/ldap/access.rb
lib/gitlab/auth/ldap/access.rb
+0
-37
lib/gitlab/auth/ldap/adapter.rb
lib/gitlab/auth/ldap/adapter.rb
+0
-3
lib/gitlab/auth/ldap/config.rb
lib/gitlab/auth/ldap/config.rb
+0
-24
lib/gitlab/auth/ldap/person.rb
lib/gitlab/auth/ldap/person.rb
+0
-6
lib/gitlab/auth/ldap/user.rb
lib/gitlab/auth/ldap/user.rb
+0
-3
lib/gitlab/auth/o_auth/auth_hash.rb
lib/gitlab/auth/o_auth/auth_hash.rb
+0
-3
lib/gitlab/auth/o_auth/user.rb
lib/gitlab/auth/o_auth/user.rb
+0
-3
lib/gitlab/auth/saml/config.rb
lib/gitlab/auth/saml/config.rb
+0
-3
lib/gitlab/auth/saml/user.rb
lib/gitlab/auth/saml/user.rb
+0
-13
spec/lib/gitlab/auth/ldap/access_spec.rb
spec/lib/gitlab/auth/ldap/access_spec.rb
+252
-1
spec/lib/gitlab/auth/ldap/user_spec.rb
spec/lib/gitlab/auth/ldap/user_spec.rb
+0
-1
No files found.
app/helpers/auth_helper.rb
View file @
2a49ec57
...
...
@@ -6,13 +6,10 @@ module AuthHelper
def
ldap_enabled?
Gitlab
::
Auth
::
LDAP
::
Config
.
enabled?
<<<<<<<
HEAD
end
def
kerberos_enabled?
auth_providers
.
include?
(
:kerberos
)
=======
>>>>>>>
upstream
/
master
end
def
omniauth_enabled?
...
...
lib/gitlab/auth/ldap/access.rb
View file @
2a49ec57
...
...
@@ -6,11 +6,7 @@ module Gitlab
module
Auth
module
LDAP
class
Access
<<<<<<<
HEAD
attr_reader
:provider
,
:user
,
:ldap_identity
=======
attr_reader
:provider
,
:user
>>>>>>>
upstream
/
master
def
self
.
open
(
user
,
&
block
)
Gitlab
::
Auth
::
LDAP
::
Adapter
.
open
(
user
.
ldap_identity
.
provider
)
do
|
adapter
|
...
...
@@ -18,18 +14,12 @@ module Gitlab
end
end
<<<<<<<
HEAD
def
self
.
allowed?
(
user
,
options
=
{})
self
.
open
(
user
)
do
|
access
|
# Whether user is allowed, or not, we should update
# permissions to keep things clean
if
access
.
allowed?
access
.
update_user
=======
def
self
.
allowed?
(
user
)
self
.
open
(
user
)
do
|
access
|
if
access
.
allowed?
>>>>>>>
upstream
/
master
Users
::
UpdateService
.
new
(
user
,
user:
user
,
last_credential_check_at:
Time
.
now
).
execute
true
...
...
@@ -42,12 +32,8 @@ module Gitlab
def
initialize
(
user
,
adapter
=
nil
)
@adapter
=
adapter
@user
=
user
<<<<<<<
HEAD
@ldap_identity
=
user
.
ldap_identity
@provider
=
adapter
&
.
provider
||
@ldap_identity
&
.
provider
=======
@provider
=
user
.
ldap_identity
.
provider
>>>>>>>
upstream
/
master
end
def
allowed?
...
...
@@ -58,11 +44,7 @@ module Gitlab
end
# Block user in GitLab if he/she was blocked in AD
<<<<<<<
HEAD
if
Gitlab
::
Auth
::
LDAP
::
Person
.
disabled_via_active_directory?
(
ldap_identity
.
extern_uid
,
adapter
)
=======
if
Gitlab
::
Auth
::
LDAP
::
Person
.
disabled_via_active_directory?
(
user
.
ldap_identity
.
extern_uid
,
adapter
)
>>>>>>>
upstream
/
master
block_user
(
user
,
'is disabled in Active Directory'
)
false
else
...
...
@@ -84,7 +66,6 @@ module Gitlab
Gitlab
::
Auth
::
LDAP
::
Config
.
new
(
provider
)
end
<<<<<<<
HEAD
def
find_ldap_user
return
unless
provider
...
...
@@ -98,16 +79,11 @@ module Gitlab
def
ldap_user
@ldap_user
||=
find_ldap_user
=======
def
ldap_user
@ldap_user
||=
Gitlab
::
Auth
::
LDAP
::
Person
.
find_by_dn
(
user
.
ldap_identity
.
extern_uid
,
adapter
)
>>>>>>>
upstream
/
master
end
def
block_user
(
user
,
reason
)
user
.
ldap_block
<<<<<<<
HEAD
if
provider
Gitlab
::
AppLogger
.
info
(
"LDAP account
\"
#{
ldap_identity
.
extern_uid
}
\"
#{
reason
}
, "
\
...
...
@@ -119,19 +95,12 @@ module Gitlab
"blocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
end
=======
Gitlab
::
AppLogger
.
info
(
"LDAP account
\"
#{
user
.
ldap_identity
.
extern_uid
}
\"
#{
reason
}
, "
\
"blocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
>>>>>>>
upstream
/
master
end
def
unblock_user
(
user
,
reason
)
user
.
activate
Gitlab
::
AppLogger
.
info
(
<<<<<<<
HEAD
"LDAP account
\"
#{
ldap_identity
.
extern_uid
}
\"
#{
reason
}
, "
\
"unblocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
...
...
@@ -241,12 +210,6 @@ module Gitlab
def
logger
Rails
.
logger
end
=======
"LDAP account
\"
#{
user
.
ldap_identity
.
extern_uid
}
\"
#{
reason
}
, "
\
"unblocking Gitlab user
\"
#{
user
.
name
}
\"
(
#{
user
.
email
}
)"
)
end
>>>>>>>
upstream
/
master
end
end
end
...
...
lib/gitlab/auth/ldap/adapter.rb
View file @
2a49ec57
...
...
@@ -2,11 +2,8 @@ module Gitlab
module
Auth
module
LDAP
class
Adapter
<<<<<<<
HEAD
prepend
::
EE
::
Gitlab
::
Auth
::
LDAP
::
Adapter
=======
>>>>>>>
upstream
/
master
attr_reader
:provider
,
:ldap
def
self
.
open
(
provider
,
&
block
)
...
...
lib/gitlab/auth/ldap/config.rb
View file @
2a49ec57
...
...
@@ -3,11 +3,8 @@ module Gitlab
module
Auth
module
LDAP
class
Config
<<<<<<<
HEAD
include
::
EE
::
Gitlab
::
Auth
::
LDAP
::
Config
=======
>>>>>>>
upstream
/
master
NET_LDAP_ENCRYPTION_METHOD
=
{
simple_tls: :simple_tls
,
start_tls: :start_tls
,
...
...
@@ -16,11 +13,8 @@ module Gitlab
attr_accessor
:provider
,
:options
<<<<<<<
HEAD
InvalidProvider
=
Class
.
new
(
StandardError
)
=======
>>>>>>>
upstream
/
master
def
self
.
enabled?
Gitlab
.
config
.
ldap
.
enabled
end
...
...
@@ -32,11 +26,7 @@ module Gitlab
def
self
.
available_servers
return
[]
unless
enabled?
<<<<<<<
HEAD
::
License
.
feature_available?
(
:multiple_ldap_servers
)
?
servers
:
Array
.
wrap
(
servers
.
first
)
=======
Array
.
wrap
(
servers
.
first
)
>>>>>>>
upstream
/
master
end
def
self
.
providers
...
...
@@ -48,11 +38,7 @@ module Gitlab
end
def
self
.
invalid_provider
(
provider
)
<<<<<<<
HEAD
raise
InvalidProvider
.
new
(
"Unknown provider (
#{
provider
}
). Available providers:
#{
providers
}
"
)
=======
raise
"Unknown provider (
#{
provider
}
). Available providers:
#{
providers
}
"
>>>>>>>
upstream
/
master
end
def
initialize
(
provider
)
...
...
@@ -102,24 +88,17 @@ module Gitlab
end
def
base
<<<<<<<
HEAD
@base
||=
Person
.
normalize_dn
(
options
[
'base'
])
=======
options
[
'base'
]
>>>>>>>
upstream
/
master
end
def
uid
options
[
'uid'
]
end
<<<<<<<
HEAD
def
label
options
[
'label'
]
end
=======
>>>>>>>
upstream
/
master
def
sync_ssh_keys?
sync_ssh_keys
.
present?
end
...
...
@@ -161,13 +140,10 @@ module Gitlab
options
[
'timeout'
].
to_i
end
<<<<<<<
HEAD
def
external_groups
options
[
'external_groups'
]
end
=======
>>>>>>>
upstream
/
master
def
has_auth?
options
[
'password'
]
||
options
[
'bind_dn'
]
end
...
...
lib/gitlab/auth/ldap/person.rb
View file @
2a49ec57
<<<<<<<
HEAD
# Contains methods common to both GitLab CE and EE.
# All EE methods should be in `EE::Gitlab::Auth::LDAP::Person` only.
=======
>>>>>>>
upstream
/
master
module
Gitlab
module
Auth
module
LDAP
class
Person
<<<<<<<
HEAD
prepend
::
EE
::
Gitlab
::
Auth
::
LDAP
::
Person
=======
>>>>>>>
upstream
/
master
# Active Directory-specific LDAP filter that checks if bit 2 of the
# userAccountControl attribute is set.
# Source: http://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/
...
...
lib/gitlab/auth/ldap/user.rb
View file @
2a49ec57
...
...
@@ -8,11 +8,8 @@ module Gitlab
module
Auth
module
LDAP
class
User
<
Gitlab
::
Auth
::
OAuth
::
User
<<<<<<<
HEAD
prepend
::
EE
::
Gitlab
::
Auth
::
LDAP
::
User
=======
>>>>>>>
upstream
/
master
class
<<
self
def
find_by_uid_and_provider
(
uid
,
provider
)
identity
=
::
Identity
.
with_extern_uid
(
provider
,
uid
).
take
...
...
lib/gitlab/auth/o_auth/auth_hash.rb
View file @
2a49ec57
...
...
@@ -4,11 +4,8 @@ module Gitlab
module
Auth
module
OAuth
class
AuthHash
<<<<<<<
HEAD
prepend
::
EE
::
Gitlab
::
Auth
::
OAuth
::
AuthHash
=======
>>>>>>>
upstream
/
master
attr_reader
:auth_hash
def
initialize
(
auth_hash
)
@auth_hash
=
auth_hash
...
...
lib/gitlab/auth/o_auth/user.rb
View file @
2a49ec57
...
...
@@ -7,11 +7,8 @@ module Gitlab
module
Auth
module
OAuth
class
User
<<<<<<<
HEAD
prepend
::
EE
::
Gitlab
::
Auth
::
OAuth
::
User
=======
>>>>>>>
upstream
/
master
SignupDisabledError
=
Class
.
new
(
StandardError
)
SigninDisabledForProviderError
=
Class
.
new
(
StandardError
)
...
...
lib/gitlab/auth/saml/config.rb
View file @
2a49ec57
...
...
@@ -14,7 +14,6 @@ module Gitlab
def
external_groups
options
[
:external_groups
]
end
<<<<<<<
HEAD
def
required_groups
Array
(
options
[
:required_groups
])
...
...
@@ -23,8 +22,6 @@ module Gitlab
def
admin_groups
options
[
:admin_groups
]
end
=======
>>>>>>>
upstream
/
master
end
end
end
...
...
lib/gitlab/auth/saml/user.rb
View file @
2a49ec57
...
...
@@ -18,7 +18,6 @@ module Gitlab
user
||=
find_or_build_ldap_user
if
auto_link_ldap_user?
user
||=
build_new_user
if
signup_enabled?
<<<<<<<
HEAD
if
user_in_required_group?
unblock_user
(
user
,
"in required group"
)
if
user
.
persisted?
&&
user
.
blocked?
elsif
user
.
persisted?
...
...
@@ -30,12 +29,6 @@ module Gitlab
if
user
user
.
external
=
!
(
auth_hash
.
groups
&
Gitlab
::
Auth
::
Saml
::
Config
.
external_groups
).
empty?
if
external_users_enabled?
user
.
admin
=
!
(
auth_hash
.
groups
&
Gitlab
::
Auth
::
Saml
::
Config
.
admin_groups
).
empty?
if
admin_groups_enabled?
=======
if
external_users_enabled?
&&
user
# Check if there is overlap between the user's groups and the external groups
# setting then set user as external or internal.
user
.
external
=
!
(
auth_hash
.
groups
&
Gitlab
::
Auth
::
Saml
::
Config
.
external_groups
).
empty?
>>>>>>>
upstream
/
master
end
user
...
...
@@ -49,7 +42,6 @@ module Gitlab
protected
<<<<<<<
HEAD
def
block_user
(
user
,
reason
)
user
.
ldap_block
log_user_changes
(
user
,
"
#{
reason
}
, blocking"
)
...
...
@@ -72,8 +64,6 @@ module Gitlab
required_groups
.
empty?
||
!
(
auth_hash
.
groups
&
required_groups
).
empty?
end
=======
>>>>>>>
upstream
/
master
def
auto_link_saml_user?
Gitlab
.
config
.
omniauth
.
auto_link_saml_user
end
...
...
@@ -85,13 +75,10 @@ module Gitlab
def
auth_hash
=
(
auth_hash
)
@auth_hash
=
Gitlab
::
Auth
::
Saml
::
AuthHash
.
new
(
auth_hash
)
end
<<<<<<<
HEAD
def
admin_groups_enabled?
!
Gitlab
::
Auth
::
Saml
::
Config
.
admin_groups
.
nil?
end
=======
>>>>>>>
upstream
/
master
end
end
end
...
...
spec/lib/gitlab/auth/ldap/access_spec.rb
View file @
2a49ec57
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/auth/ldap/user_spec.rb
View file @
2a49ec57
...
...
@@ -26,7 +26,6 @@ describe Gitlab::Auth::LDAP::User do
let
(
:auth_hash_upper_case
)
do
OmniAuth
::
AuthHash
.
new
(
uid:
'uid=John Smith,ou=People,dc=example,dc=com'
,
provider:
'ldapmain'
,
info:
info_upper_case
)
end
let!
(
:fake_proxy
)
{
fake_ldap_sync_proxy
(
'ldapmain'
)
}
describe
'#changed?'
do
it
"marks existing ldap user as 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