diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-06-26 12:25:08 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-05 12:38:25 +0300 |
commit | 6e8ea52be6f75c99556ee4615f6213d991969bfd (patch) | |
tree | f4d5c894eea7e1bf76a0f21f527e69cf7bcc1af5 /app/policies/ci | |
parent | e364c118a05e4d11677b997a5e31b2f1aa8a4a92 (diff) |
Add functionality and security.
Diffstat (limited to 'app/policies/ci')
-rw-r--r-- | app/policies/ci/pipeline_schedule_policy.rb | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/app/policies/ci/pipeline_schedule_policy.rb b/app/policies/ci/pipeline_schedule_policy.rb index db561dafbd3..2506c179157 100644 --- a/app/policies/ci/pipeline_schedule_policy.rb +++ b/app/policies/ci/pipeline_schedule_policy.rb @@ -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 |