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
c5e16d52
Commit
c5e16d52
authored
Jun 27, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define authorize_update_pipeline_schedule and apply to :edit, :take_ownership, :update
parent
08ed07cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
app/controllers/projects/pipeline_schedules_controller.rb
app/controllers/projects/pipeline_schedules_controller.rb
+6
-4
No files found.
app/controllers/projects/pipeline_schedules_controller.rb
View file @
c5e16d52
class
Projects::PipelineSchedulesController
<
Projects
::
ApplicationController
class
Projects::PipelineSchedulesController
<
Projects
::
ApplicationController
before_action
:schedule
,
only:
[
:edit
,
:update
,
:destroy
,
:take_ownership
]
before_action
:authorize_read_pipeline_schedule!
before_action
:authorize_read_pipeline_schedule!
before_action
:authorize_create_pipeline_schedule!
,
only:
[
:new
,
:create
]
before_action
:authorize_create_pipeline_schedule!
,
only:
[
:new
,
:create
]
before_action
:authorize_update_pipeline_schedule!
,
only:
[
:edit
,
:take_ownership
,
:update
]
before_action
:authorize_update_pipeline_schedule!
,
only:
[
:edit
,
:take_ownership
,
:update
]
before_action
:authorize_admin_pipeline_schedule!
,
only:
[
:destroy
]
before_action
:authorize_admin_pipeline_schedule!
,
only:
[
:destroy
]
before_action
:schedule
,
only:
[
:edit
,
:update
,
:destroy
,
:take_ownership
]
def
index
def
index
@scope
=
params
[
:scope
]
@scope
=
params
[
:scope
]
@all_schedules
=
PipelineSchedulesFinder
.
new
(
@project
).
execute
@all_schedules
=
PipelineSchedulesFinder
.
new
(
@project
).
execute
...
@@ -33,8 +33,6 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
...
@@ -33,8 +33,6 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
end
end
def
update
def
update
return
access_denied!
unless
can?
(
current_user
,
:update_pipeline_schedule
,
schedule
)
if
Ci
::
CreatePipelineScheduleService
if
Ci
::
CreatePipelineScheduleService
.
new
(
@project
,
current_user
,
schedule_params
).
update
(
schedule
)
.
new
(
@project
,
current_user
,
schedule_params
).
update
(
schedule
)
redirect_to
namespace_project_pipeline_schedules_path
(
@project
.
namespace
.
becomes
(
Namespace
),
@project
)
redirect_to
namespace_project_pipeline_schedules_path
(
@project
.
namespace
.
becomes
(
Namespace
),
@project
)
...
@@ -72,4 +70,8 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
...
@@ -72,4 +70,8 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
.
permit
(
:description
,
:cron
,
:cron_timezone
,
:ref
,
:active
,
.
permit
(
:description
,
:cron
,
:cron_timezone
,
:ref
,
:active
,
variables_attributes:
[
:id
,
:key
,
:value
,
:_destroy
]
)
variables_attributes:
[
:id
,
:key
,
:value
,
:_destroy
]
)
end
end
def
authorize_update_pipeline_schedule!
return
access_denied!
unless
can?
(
current_user
,
:update_pipeline_schedule
,
schedule
)
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