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
baf43a0a
Commit
baf43a0a
authored
Nov 29, 2019
by
Furkan Ayhan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add protected branch permission check to run downstream pipelines
parent
ecf2d069
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
changelogs/unreleased/bug-35083-check-permission-for-downstream-pipeline.yml
...ed/bug-35083-check-permission-for-downstream-pipeline.yml
+5
-0
ee/app/services/ci/create_cross_project_pipeline_service.rb
ee/app/services/ci/create_cross_project_pipeline_service.rb
+6
-1
ee/spec/services/ci/create_cross_project_pipeline_service_spec.rb
...services/ci/create_cross_project_pipeline_service_spec.rb
+14
-0
No files found.
changelogs/unreleased/bug-35083-check-permission-for-downstream-pipeline.yml
0 → 100644
View file @
baf43a0a
---
title
:
Add protected branch permission check to run downstream pipelines
merge_request
:
20964
author
:
type
:
fixed
ee/app/services/ci/create_cross_project_pipeline_service.rb
View file @
baf43a0a
...
...
@@ -31,7 +31,12 @@ module Ci
def
can_create_cross_pipeline?
can?
(
current_user
,
:update_pipeline
,
project
)
&&
can?
(
target_user
,
:create_pipeline
,
target_project
)
can?
(
target_user
,
:create_pipeline
,
target_project
)
&&
can_update_branch?
end
def
can_update_branch?
::
Gitlab
::
UserAccess
.
new
(
target_user
,
project:
target_project
).
can_update_branch?
(
target_ref
)
end
def
create_pipeline!
...
...
ee/spec/services/ci/create_cross_project_pipeline_service_spec.rb
View file @
baf43a0a
...
...
@@ -223,5 +223,19 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
end
end
end
context
'when user does not have access to push protected branch of downstream project'
do
before
do
create
(
:protected_branch
,
:maintainers_can_push
,
project:
downstream_project
,
name:
'feature'
)
end
it
'changes status of the bridge build'
do
service
.
execute
(
bridge
)
expect
(
bridge
.
reload
).
to
be_failed
expect
(
bridge
.
failure_reason
).
to
eq
'insufficient_bridge_permissions'
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