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
b84e373f
Commit
b84e373f
authored
Sep 08, 2020
by
Laura Montemayor
Committed by
lauraMon
Sep 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds back read_build authorization
* Adds comment about removing filter_builds method after FF is removed
parent
ee1f9b7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
lib/api/ci/pipelines.rb
lib/api/ci/pipelines.rb
+12
-10
No files found.
lib/api/ci/pipelines.rb
View file @
b84e373f
...
...
@@ -133,6 +133,7 @@ module API
.
new
(
current_user:
current_user
,
pipeline:
pipeline
,
params:
params
)
.
execute
else
authorize!
(
:read_build
,
pipeline
)
builds
=
pipeline
.
builds
builds
=
filter_builds
(
builds
,
params
[
:scope
])
end
...
...
@@ -161,6 +162,7 @@ module API
.
new
(
current_user:
current_user
,
pipeline:
pipeline
,
params:
params
,
type:
::
Ci
::
Bridge
)
.
execute
else
authorize!
(
:read_pipeline
,
pipeline
)
bridges
=
pipeline
.
bridges
bridges
=
filter_builds
(
bridges
,
params
[
:scope
])
end
...
...
@@ -244,20 +246,20 @@ module API
end
helpers
do
if
Feature
.
disabled?
(
:ci_jobs_finder_refactor
)
# rubocop: disable CodeReuse/ActiveRecord
def
filter_builds
(
builds
,
scope
)
return
builds
if
scope
.
nil?
||
scope
.
empty?
# NOTE: This method should be removed once the ci_jobs_finder_refactor FF is
# removed. https://gitlab.com/gitlab-org/gitlab/-/issues/245183
# rubocop: disable CodeReuse/ActiveRecord
def
filter_builds
(
builds
,
scope
)
return
builds
if
scope
.
nil?
||
scope
.
empty?
available_statuses
=
::
CommitStatus
::
AVAILABLE_STATUSES
available_statuses
=
::
CommitStatus
::
AVAILABLE_STATUSES
unknown
=
scope
-
available_statuses
render_api_error!
(
'Scope contains invalid value(s)'
,
400
)
unless
unknown
.
empty?
unknown
=
scope
-
available_statuses
render_api_error!
(
'Scope contains invalid value(s)'
,
400
)
unless
unknown
.
empty?
builds
.
where
(
status:
scope
)
end
# rubocop: enable CodeReuse/ActiveRecord
builds
.
where
(
status:
scope
)
end
# rubocop: enable CodeReuse/ActiveRecord
def
pipeline
strong_memoize
(
:pipeline
)
do
...
...
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