summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2017-03-07 13:02:56 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-03-07 13:02:56 +0000
commit32dee03b2fec293a8581034301bab9d4a3f86d1a (patch)
treead477e7c5f843e7d14dad02784fab4c540e8818e /app/policies
parentb729b171981c6156164a1070c2b366f7d1986a1d (diff)
downloadgitlab-ce-32dee03b2fec293a8581034301bab9d4a3f86d1a.tar.gz
Improve pipeline triggers UI
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/ci/trigger_policy.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/policies/ci/trigger_policy.rb b/app/policies/ci/trigger_policy.rb
new file mode 100644
index 00000000000..c90c9ac0583
--- /dev/null
+++ b/app/policies/ci/trigger_policy.rb
@@ -0,0 +1,13 @@
+module Ci
+ class TriggerPolicy < BasePolicy
+ def rules
+ delegate! @subject.project
+
+ if can?(:admin_build)
+ can! :admin_trigger if @subject.owner.blank? ||
+ @subject.owner == @user
+ can! :manage_trigger
+ end
+ end
+ end
+end