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
eb0fbb28
Commit
eb0fbb28
authored
Oct 22, 2020
by
Serena Fang
Committed by
James Lopez
Oct 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix allowlist bug that prevented project access token creation
parent
a53ff11f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
ee/app/models/ee/group_member.rb
ee/app/models/ee/group_member.rb
+2
-0
ee/app/models/ee/project_team.rb
ee/app/models/ee/project_team.rb
+3
-1
ee/spec/models/group_member_spec.rb
ee/spec/models/group_member_spec.rb
+12
-0
ee/spec/models/project_team_spec.rb
ee/spec/models/project_team_spec.rb
+11
-1
No files found.
ee/app/models/ee/group_member.rb
View file @
eb0fbb28
...
...
@@ -38,6 +38,8 @@ module EE
def
group_domain_limitations
if
user
return
if
user
.
project_bot?
validate_users_email
validate_email_verified
else
...
...
ee/app/models/ee/project_team.rb
View file @
eb0fbb28
...
...
@@ -14,7 +14,9 @@ module EE
override
:add_user
def
add_user
(
user
,
access_level
,
current_user:
nil
,
expires_at:
nil
)
return
false
if
group_member_lock
if
group_member_lock
&&
!
user
.
project_bot?
return
false
end
super
end
...
...
ee/spec/models/group_member_spec.rb
View file @
eb0fbb28
...
...
@@ -43,6 +43,18 @@ RSpec.describe GroupMember do
expect
(
group_member
.
errors
[
:user
]).
to
include
(
"email 'unverified@gitlab.com' is not a verified email."
)
end
context
'with project bot users'
do
let_it_be
(
:project_bot
)
{
create
(
:user
,
:project_bot
,
email:
"bot@example.com"
)
}
it
'bot user email does not match'
do
expect
(
group
.
allowed_email_domains
.
include?
(
project_bot
.
email
)).
to
be_falsey
end
it
'allows the project bot user'
do
expect
(
build
(
:group_member
,
group:
group
,
user:
project_bot
)).
to
be_valid
end
end
context
'with group SAML users'
do
let
(
:saml_provider
)
{
create
(
:saml_provider
,
group:
group
)
}
...
...
ee/spec/models/project_team_spec.rb
View file @
eb0fbb28
...
...
@@ -35,7 +35,17 @@ RSpec.describe ProjectTeam do
it
'does not add the given user to the team'
do
project
.
team
.
add_user
(
user
,
:reporter
)
expect
(
project
.
team
.
reporter?
(
user
)).
to
be
(
false
)
expect
(
project
.
members
.
map
(
&
:user
)).
not_to
include
(
user
)
end
context
'project bot user'
do
let_it_be
(
:project_bot
)
{
create
(
:user
,
:project_bot
)
}
it
'adds the project bot user to the team'
do
project
.
team
.
add_user
(
project_bot
,
:maintainer
)
expect
(
project
.
members
.
map
(
&
:user
)).
to
include
(
project_bot
)
end
end
end
end
...
...
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