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
63081351
Commit
63081351
authored
Oct 22, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EE] Fix a bug where internal email pattern wasn't respected
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
7c4a0452
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
7 deletions
+43
-7
app/services/users/build_service.rb
app/services/users/build_service.rb
+4
-4
changelogs/unreleased/52940-fix-internal-email-pattern-not-respected.yml
...leased/52940-fix-internal-email-pattern-not-respected.yml
+5
-0
ee/spec/lib/gitlab/auth/ldap/user_spec.rb
ee/spec/lib/gitlab/auth/ldap/user_spec.rb
+31
-0
spec/services/users/build_service_spec.rb
spec/services/users/build_service_spec.rb
+3
-3
No files found.
app/services/users/build_service.rb
View file @
63081351
...
...
@@ -97,10 +97,6 @@ module Users
if
params
[
:reset_password
]
user_params
.
merge!
(
force_random_password:
true
,
password_expires_at:
nil
)
end
if
user_default_internal_regex_enabled?
&&
!
user_params
.
key?
(
:external
)
user_params
[
:external
]
=
user_external?
end
else
allowed_signup_params
=
signup_params
allowed_signup_params
<<
:skip_confirmation
if
skip_authorization
...
...
@@ -111,6 +107,10 @@ module Users
end
end
if
user_default_internal_regex_enabled?
&&
!
user_params
.
key?
(
:external
)
user_params
[
:external
]
=
user_external?
end
user_params
end
...
...
changelogs/unreleased/52940-fix-internal-email-pattern-not-respected.yml
0 → 100644
View file @
63081351
---
title
:
Fix a bug where internal email pattern wasn't respected
merge_request
:
22516
author
:
type
:
fixed
ee/spec/lib/gitlab/auth/ldap/user_spec.rb
View file @
63081351
...
...
@@ -68,6 +68,37 @@ describe Gitlab::Auth::LDAP::User do
end
end
end
context
'with "user_default_external" application setting'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:user_default_external
,
:user_default_internal_regex
,
:user_is_in_external_group
,
:expected_to_be_external
)
do
true
|
nil
|
false
|
false
true
|
'example.com'
|
false
|
false
true
|
nil
|
true
|
true
true
|
'example.com'
|
true
|
true
false
|
nil
|
false
|
false
false
|
'example.com'
|
false
|
false
false
|
nil
|
true
|
true
false
|
'example.com'
|
true
|
true
end
with_them
do
let
(
:group_member_dns
)
{
[
'uid=someone_else,ou=people,dc=example,dc=com'
,
user_is_in_external_group
?
auth_hash
.
uid
:
nil
].
compact
}
before
do
stub_application_setting
(
user_default_external:
user_default_external
)
stub_application_setting
(
user_default_internal_regex:
user_default_internal_regex
)
end
it
"sets the user's external flag appropriately"
do
expect
(
gl_user
.
external
).
to
eq
(
expected_to_be_external
)
end
end
end
end
context
'when there is more than one external group'
do
...
...
spec/services/users/build_service_spec.rb
View file @
63081351
...
...
@@ -159,9 +159,9 @@ describe Users::BuildService do
true
|
true
|
'fl@example.com'
|
''
|
true
true
|
false
|
'fl@example.com'
|
''
|
true
true
|
nil
|
'fl@example.com'
|
'^(?:(?!\.ext@).)*$\r?'
|
tru
e
true
|
true
|
'fl@example.com'
|
'^(?:(?!\.ext@).)*$\r?'
|
tru
e
true
|
false
|
'fl@example.com'
|
'^(?:(?!\.ext@).)*$\r?'
|
tru
e
true
|
nil
|
'fl@example.com'
|
'^(?:(?!\.ext@).)*$\r?'
|
fals
e
true
|
true
|
'fl@example.com'
|
'^(?:(?!\.ext@).)*$\r?'
|
fals
e
true
|
false
|
'fl@example.com'
|
'^(?:(?!\.ext@).)*$\r?'
|
fals
e
true
|
nil
|
'tester.ext@domain.com'
|
'^(?:(?!\.ext@).)*$\r?'
|
true
true
|
true
|
'tester.ext@domain.com'
|
'^(?:(?!\.ext@).)*$\r?'
|
true
...
...
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