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
f35563b2
Commit
f35563b2
authored
Jul 27, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make access level more compatible with EE
So the behaviour would be similar in CE and EE
parent
190fae5f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
15 deletions
+71
-15
spec/factories/protected_branches.rb
spec/factories/protected_branches.rb
+41
-9
spec/factories/protected_tags.rb
spec/factories/protected_tags.rb
+30
-6
No files found.
spec/factories/protected_branches.rb
View file @
f35563b2
...
@@ -3,26 +3,58 @@ FactoryGirl.define do
...
@@ -3,26 +3,58 @@ FactoryGirl.define do
name
name
project
project
after
(
:build
)
do
|
protected_branch
|
transient
do
protected_branch
.
push_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MASTER
)
default_push_level
true
protected_branch
.
merge_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MASTER
)
default_merge_level
true
default_access_level
true
end
end
trait
:developers_can_push
do
trait
:developers_can_push
do
after
(
:create
)
do
|
protected_branch
|
transient
do
protected_branch
.
push_access_levels
.
first
.
update!
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
default_push_level
false
end
after
(
:build
)
do
|
protected_branch
|
protected_branch
.
push_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
end
end
end
end
trait
:developers_can_merge
do
trait
:developers_can_merge
do
after
(
:create
)
do
|
protected_branch
|
transient
do
protected_branch
.
merge_access_levels
.
first
.
update!
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
default_merge_level
false
end
after
(
:build
)
do
|
protected_branch
|
protected_branch
.
merge_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
end
end
end
end
trait
:no_one_can_push
do
trait
:no_one_can_push
do
after
(
:create
)
do
|
protected_branch
|
transient
do
protected_branch
.
push_access_levels
.
first
.
update!
(
access_level:
Gitlab
::
Access
::
NO_ACCESS
)
default_push_level
false
end
after
(
:build
)
do
|
protected_branch
|
protected_branch
.
push_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
NO_ACCESS
)
end
end
trait
:masters_can_push
do
transient
do
default_push_level
false
end
after
(
:build
)
do
|
protected_branch
|
protected_branch
.
push_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MASTER
)
end
end
after
(
:build
)
do
|
protected_branch
,
evaluator
|
if
evaluator
.
default_access_level
&&
evaluator
.
default_push_level
protected_branch
.
push_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MASTER
)
end
if
evaluator
.
default_access_level
&&
evaluator
.
default_merge_level
protected_branch
.
merge_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MASTER
)
end
end
end
end
end
end
...
...
spec/factories/protected_tags.rb
View file @
f35563b2
...
@@ -3,19 +3,43 @@ FactoryGirl.define do
...
@@ -3,19 +3,43 @@ FactoryGirl.define do
name
name
project
project
after
(
:build
)
do
|
protected_tag
|
transient
do
protected_tag
.
create_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MASTER
)
default_access_level
true
end
end
trait
:developers_can_create
do
trait
:developers_can_create
do
after
(
:create
)
do
|
protected_tag
|
transient
do
protected_tag
.
create_access_levels
.
first
.
update!
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
default_access_level
false
end
after
(
:build
)
do
|
protected_tag
|
protected_tag
.
create_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
end
end
end
end
trait
:no_one_can_create
do
trait
:no_one_can_create
do
after
(
:create
)
do
|
protected_tag
|
transient
do
protected_tag
.
create_access_levels
.
first
.
update!
(
access_level:
Gitlab
::
Access
::
NO_ACCESS
)
default_access_level
false
end
after
(
:build
)
do
|
protected_tag
|
protected_tag
.
create_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
NO_ACCESS
)
end
end
trait
:masters_can_create
do
transient
do
default_access_level
false
end
after
(
:build
)
do
|
protected_tag
|
protected_tag
.
create_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MASTER
)
end
end
after
(
:build
)
do
|
protected_tag
,
evaluator
|
if
evaluator
.
default_access_level
protected_tag
.
create_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MASTER
)
end
end
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