BigW Consortium Gitlab

deploy_key_policy.rb 371 Bytes
Newer Older
1
class DeployKeyPolicy < BasePolicy
2 3
  with_options scope: :subject, score: 0
  condition(:private_deploy_key) { @subject.private? }
4

5
  condition(:has_deploy_key) { @user.project_deploy_keys.exists?(id: @subject.id) }
6

7 8 9 10
  rule { anonymous }.prevent_all

  rule { admin }.enable :update_deploy_key
  rule { private_deploy_key & has_deploy_key }.enable :update_deploy_key
11
end