diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-06-27 16:16:15 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-05 18:36:18 +0900 |
commit | c3635dd1cbf2cfbab67264eb095f85d7f6004a73 (patch) | |
tree | 9e75d6de4e1f568b204b93826012ed00446153dc /app/policies | |
parent | 8e2aafcd1c2da329f7fab3f76e625ba86e14fec3 (diff) | |
download | gitlab-ce-c3635dd1cbf2cfbab67264eb095f85d7f6004a73.tar.gz |
Improve PipelineSchedulePolicy
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/ci/pipeline_schedule_policy.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/policies/ci/pipeline_schedule_policy.rb b/app/policies/ci/pipeline_schedule_policy.rb index 2506c179157..9945fec3aaa 100644 --- a/app/policies/ci/pipeline_schedule_policy.rb +++ b/app/policies/ci/pipeline_schedule_policy.rb @@ -5,11 +5,15 @@ module Ci def rules super - access = pipeline_schedule.project.team.max_member_access(user.id) - - if access == Gitlab::Access::DEVELOPER && pipeline_schedule.owner != user + if owned_by_developer? && pipeline_schedule.owner != user cannot! :update_pipeline_schedule end end + + private + + def owned_by_developer? + pipeline_schedule.project.team.developer?(user) + end end end |