Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Randa <randa.alex@gmail.com>2017-03-31 15:54:38 +0300
committerAlexander Randa <randa.alex@gmail.com>2017-06-02 19:44:36 +0300
commit3d70eeb5bb9dac8073a149547dc3b85c90d65e7d (patch)
treeb925f3518e991df59a094ae9d7a6926241c9f5aa /app/policies
parentf07aee72bef4604312e11a43fce3a47865bce100 (diff)
Implement ability to update deploy keys
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/deploy_key_policy.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/policies/deploy_key_policy.rb b/app/policies/deploy_key_policy.rb
new file mode 100644
index 00000000000..ebab213e6be
--- /dev/null
+++ b/app/policies/deploy_key_policy.rb
@@ -0,0 +1,11 @@
+class DeployKeyPolicy < BasePolicy
+ def rules
+ return unless @user
+
+ can! :update_deploy_key if @user.admin?
+
+ if @subject.private? && @user.project_deploy_keys.exists?(id: @subject.id)
+ can! :update_deploy_key
+ end
+ end
+end