diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-05 13:25:24 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-05 13:25:24 +0300 |
commit | 936367538043854c7b093b71ca315b8e469c55a4 (patch) | |
tree | 9cf4a769d9cffd234ad00cfadb940bcb14553c07 /app/policies/ci | |
parent | b6facd8313f2996ffef9be8eb2c98d5146d7a137 (diff) |
Use update build policy instead of new play policy
Diffstat (limited to 'app/policies/ci')
-rw-r--r-- | app/policies/ci/build_policy.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/policies/ci/build_policy.rb b/app/policies/ci/build_policy.rb index 2c39d31488f..d4af4490608 100644 --- a/app/policies/ci/build_policy.rb +++ b/app/policies/ci/build_policy.rb @@ -1,5 +1,7 @@ module Ci class BuildPolicy < CommitStatusPolicy + alias_method :build, :subject + def rules super @@ -9,17 +11,17 @@ module Ci cannot! :"#{rule}_commit_status" unless can? :"#{rule}_build" end - can! :play_build if can_play_action? + if can?(:update_build) && protected_action? + cannot! :update_build + end end private - alias_method :build, :subject - - def can_play_action? + def protected_action? return false unless build.action? - ::Gitlab::UserAccess + !::Gitlab::UserAccess .new(user, project: build.project) .can_push_to_branch?(build.ref) end |