BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
6e8ea52b
Commit
6e8ea52b
authored
Jun 26, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add functionality and security.
parent
e364c118
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
16 deletions
+8
-16
pipeline_schedules_controller.rb
app/controllers/projects/pipeline_schedules_controller.rb
+2
-0
pipeline_schedule_policy.rb
app/policies/ci/pipeline_schedule_policy.rb
+6
-16
pipeline_schedules_controller_spec.rb
...ontrollers/projects/pipeline_schedules_controller_spec.rb
+0
-0
No files found.
app/controllers/projects/pipeline_schedules_controller.rb
View file @
6e8ea52b
...
...
@@ -33,6 +33,8 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
end
def
update
return
access_denied!
unless
can?
(
current_user
,
:update_pipeline_schedule
,
schedule
)
if
Ci
::
CreatePipelineScheduleService
.
new
(
@project
,
current_user
,
schedule_params
).
update
(
schedule
)
redirect_to
namespace_project_pipeline_schedules_path
(
@project
.
namespace
.
becomes
(
Namespace
),
@project
)
...
...
app/policies/ci/pipeline_schedule_policy.rb
View file @
6e8ea52b
...
...
@@ -2,24 +2,14 @@ module Ci
class
PipelineSchedulePolicy
<
PipelinePolicy
alias_method
:pipeline_schedule
,
:subject
condition
(
:protected_action
)
do
owned_by_developer?
&&
owned_by_another?
end
rule
{
protected_action
}.
prevent
:update_pipeline_schedule
private
def
owned_by_developer?
return
false
unless
@user
pipeline_schedule
.
project
.
team
.
developer?
(
@user
)
end
def
rules
super
def
owned_by_another?
return
false
unless
@user
access
=
pipeline_schedule
.
project
.
team
.
max_member_access
(
user
.
id
)
!
pipeline_schedule
.
owned_by?
(
@user
)
if
access
==
Gitlab
::
Access
::
DEVELOPER
&&
pipeline_schedule
.
owner
!=
user
cannot!
:update_pipeline_schedule
end
end
end
end
spec/controllers/projects/pipeline_schedules_controller_spec.rb
View file @
6e8ea52b
This diff is collapsed.
Click to expand it.
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