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
bb22989c
Commit
bb22989c
authored
Aug 30, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve def pipeline_schedule with authrozation code
parent
362f2226
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
lib/api/pipeline_schedules.rb
lib/api/pipeline_schedules.rb
+13
-16
No files found.
lib/api/pipeline_schedules.rb
View file @
bb22989c
...
@@ -31,8 +31,6 @@ module API
...
@@ -31,8 +31,6 @@ module API
requires
:pipeline_schedule_id
,
type:
Integer
,
desc:
'The pipeline schedule id'
requires
:pipeline_schedule_id
,
type:
Integer
,
desc:
'The pipeline schedule id'
end
end
get
':id/pipeline_schedules/:pipeline_schedule_id'
do
get
':id/pipeline_schedules/:pipeline_schedule_id'
do
authorize!
:read_pipeline_schedule
,
user_project
present
pipeline_schedule
,
with:
Entities
::
PipelineScheduleDetails
present
pipeline_schedule
,
with:
Entities
::
PipelineScheduleDetails
end
end
...
@@ -72,7 +70,6 @@ module API
...
@@ -72,7 +70,6 @@ module API
optional
:active
,
type:
Boolean
,
desc:
'The activation of pipeline schedule'
optional
:active
,
type:
Boolean
,
desc:
'The activation of pipeline schedule'
end
end
put
':id/pipeline_schedules/:pipeline_schedule_id'
do
put
':id/pipeline_schedules/:pipeline_schedule_id'
do
authorize!
:read_pipeline_schedule
,
user_project
authorize!
:update_pipeline_schedule
,
pipeline_schedule
authorize!
:update_pipeline_schedule
,
pipeline_schedule
if
pipeline_schedule
.
update
(
declared_params
(
include_missing:
false
))
if
pipeline_schedule
.
update
(
declared_params
(
include_missing:
false
))
...
@@ -89,7 +86,6 @@ module API
...
@@ -89,7 +86,6 @@ module API
requires
:pipeline_schedule_id
,
type:
Integer
,
desc:
'The pipeline schedule id'
requires
:pipeline_schedule_id
,
type:
Integer
,
desc:
'The pipeline schedule id'
end
end
post
':id/pipeline_schedules/:pipeline_schedule_id/take_ownership'
do
post
':id/pipeline_schedules/:pipeline_schedule_id/take_ownership'
do
authorize!
:read_pipeline_schedule
,
user_project
authorize!
:update_pipeline_schedule
,
pipeline_schedule
authorize!
:update_pipeline_schedule
,
pipeline_schedule
if
pipeline_schedule
.
own!
(
current_user
)
if
pipeline_schedule
.
own!
(
current_user
)
...
@@ -106,7 +102,6 @@ module API
...
@@ -106,7 +102,6 @@ module API
requires
:pipeline_schedule_id
,
type:
Integer
,
desc:
'The pipeline schedule id'
requires
:pipeline_schedule_id
,
type:
Integer
,
desc:
'The pipeline schedule id'
end
end
delete
':id/pipeline_schedules/:pipeline_schedule_id'
do
delete
':id/pipeline_schedules/:pipeline_schedule_id'
do
authorize!
:read_pipeline_schedule
,
user_project
authorize!
:admin_pipeline_schedule
,
pipeline_schedule
authorize!
:admin_pipeline_schedule
,
pipeline_schedule
destroy_conditionally!
(
pipeline_schedule
)
destroy_conditionally!
(
pipeline_schedule
)
...
@@ -121,7 +116,6 @@ module API
...
@@ -121,7 +116,6 @@ module API
requires
:value
,
type:
String
,
desc:
'The value of the variable'
requires
:value
,
type:
String
,
desc:
'The value of the variable'
end
end
post
':id/pipeline_schedules/:pipeline_schedule_id/variables'
do
post
':id/pipeline_schedules/:pipeline_schedule_id/variables'
do
authorize!
:read_pipeline_schedule
,
user_project
authorize!
:update_pipeline_schedule
,
pipeline_schedule
authorize!
:update_pipeline_schedule
,
pipeline_schedule
variable_params
=
declared_params
(
include_missing:
false
)
variable_params
=
declared_params
(
include_missing:
false
)
...
@@ -142,7 +136,6 @@ module API
...
@@ -142,7 +136,6 @@ module API
optional
:value
,
type:
String
,
desc:
'The value of the variable'
optional
:value
,
type:
String
,
desc:
'The value of the variable'
end
end
put
':id/pipeline_schedules/:pipeline_schedule_id/variables/:key'
do
put
':id/pipeline_schedules/:pipeline_schedule_id/variables/:key'
do
authorize!
:read_pipeline_schedule
,
user_project
authorize!
:update_pipeline_schedule
,
pipeline_schedule
authorize!
:update_pipeline_schedule
,
pipeline_schedule
if
pipeline_schedule_variable
.
update
(
declared_params
(
include_missing:
false
))
if
pipeline_schedule_variable
.
update
(
declared_params
(
include_missing:
false
))
...
@@ -160,7 +153,6 @@ module API
...
@@ -160,7 +153,6 @@ module API
requires
:key
,
type:
String
,
desc:
'The key of the variable'
requires
:key
,
type:
String
,
desc:
'The key of the variable'
end
end
delete
':id/pipeline_schedules/:pipeline_schedule_id/variables/:key'
do
delete
':id/pipeline_schedules/:pipeline_schedule_id/variables/:key'
do
authorize!
:read_pipeline_schedule
,
user_project
authorize!
:admin_pipeline_schedule
,
pipeline_schedule
authorize!
:admin_pipeline_schedule
,
pipeline_schedule
status
:accepted
status
:accepted
...
@@ -171,18 +163,23 @@ module API
...
@@ -171,18 +163,23 @@ module API
helpers
do
helpers
do
def
pipeline_schedule
def
pipeline_schedule
@pipeline_schedule
||=
@pipeline_schedule
||=
user_project
.
pipeline_schedules
user_project
.
preload
(
:owner
,
:last_pipeline
)
.
pipeline_schedules
.
find_by
(
id:
params
.
delete
(
:pipeline_schedule_id
))
.
preload
(
:owner
,
:last_pipeline
)
.
find_by
(
id:
params
.
delete
(
:pipeline_schedule_id
)).
tap
do
|
pipeline_schedule
|
@pipeline_schedule
||
not_found!
(
'Pipeline Schedule'
)
unless
pipeline_schedule
||
can?
(
current_user
,
:read_pipeline_schedule
,
pipeline_schedule
)
not_found!
(
'Pipeline Schedule'
)
end
end
end
end
def
pipeline_schedule_variable
def
pipeline_schedule_variable
@pipeline_schedule_variable
||=
@pipeline_schedule_variable
||=
pipeline_schedule
.
variables
.
find_by
(
key:
params
[
:key
])
pipeline_schedule
.
variables
.
find_by
(
key:
params
[
:key
]).
tap
do
|
pipeline_schedule_variable
|
unless
pipeline_schedule_variable
@pipeline_schedule_variable
||
not_found!
(
'Pipeline Schedule Variable'
)
not_found!
(
'Pipeline Schedule Variable'
)
end
end
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