summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-04-04 18:43:41 -0500
committerMayra Cabrera <mcabrera@gitlab.com>2018-04-06 21:20:16 -0500
commit171b2625b128e5954ce0a150a4fc923a22164e4e (patch)
tree834586c27477a404e71fe2fac9d17ecf3e495e58 /app/policies
parent7deab3172257bef7818ce834c1e0709432ddd5e0 (diff)
downloadgitlab-ce-171b2625b128e5954ce0a150a4fc923a22164e4e.tar.gz
Addreses backend review suggestions
- Remove extra method for authorize_admin_project - Ensure project presence - Rename 'read_repo' to 'read_repository' to be more verbose
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/deploy_token_policy.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/policies/deploy_token_policy.rb b/app/policies/deploy_token_policy.rb
new file mode 100644
index 00000000000..7aa9106e8b1
--- /dev/null
+++ b/app/policies/deploy_token_policy.rb
@@ -0,0 +1,11 @@
+class DeployTokenPolicy < BasePolicy
+ with_options scope: :subject, score: 0
+ condition(:master) { @subject.project.team.master?(@user) }
+
+ rule { anonymous }.prevent_all
+
+ rule { master }.policy do
+ enable :create_deploy_token
+ enable :update_deploy_token
+ end
+end