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
679789ee
Commit
679789ee
authored
Jul 18, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename can_push_or_merge_to_branch? to can_update_branch?
Also make sure pipeline would also check against tag as well
parent
c86e74b2
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
app/policies/ci/build_policy.rb
app/policies/ci/build_policy.rb
+1
-1
app/policies/ci/pipeline_policy.rb
app/policies/ci/pipeline_policy.rb
+7
-3
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+1
-1
lib/gitlab/user_access.rb
lib/gitlab/user_access.rb
+1
-1
No files found.
app/policies/ci/build_policy.rb
View file @
679789ee
...
...
@@ -6,7 +6,7 @@ module Ci
if
@subject
.
tag?
!
access
.
can_create_tag?
(
@subject
.
ref
)
else
!
access
.
can_
push_or_merge_to
_branch?
(
@subject
.
ref
)
!
access
.
can_
update
_branch?
(
@subject
.
ref
)
end
end
...
...
app/policies/ci/pipeline_policy.rb
View file @
679789ee
...
...
@@ -3,9 +3,13 @@ module Ci
delegate
{
@subject
.
project
}
condition
(
:user_cannot_update
)
do
!::
Gitlab
::
UserAccess
.
new
(
@user
,
project:
@subject
.
project
)
.
can_push_or_merge_to_branch?
(
@subject
.
ref
)
access
=
::
Gitlab
::
UserAccess
.
new
(
@user
,
project:
@subject
.
project
)
if
@subject
.
tag?
!
access
.
can_create_tag?
(
@subject
.
ref
)
else
!
access
.
can_update_branch?
(
@subject
.
ref
)
end
end
rule
{
user_cannot_update
}.
prevent
:update_pipeline
...
...
app/services/ci/create_pipeline_service.rb
View file @
679789ee
...
...
@@ -89,7 +89,7 @@ module Ci
Ability
.
allowed?
(
triggering_user
,
:create_pipeline
,
project
)
&&
if
branch?
access
.
can_
push_or_merge_to
_branch?
(
ref
)
access
.
can_
update
_branch?
(
ref
)
elsif
tag?
access
.
can_create_tag?
(
ref
)
else
...
...
lib/gitlab/user_access.rb
View file @
679789ee
...
...
@@ -54,7 +54,7 @@ module Gitlab
end
end
def
can_
push_or_merge_to
_branch?
(
ref
)
def
can_
update
_branch?
(
ref
)
can_push_to_branch?
(
ref
)
||
can_merge_to_branch?
(
ref
)
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