diff options
Diffstat (limited to 'app/policies/project_policy.rb')
-rw-r--r-- | app/policies/project_policy.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index e93c60c3710..3cb4644a60d 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -69,6 +69,16 @@ class ProjectPolicy < BasePolicy project.merge_requests_allowing_push_to_user(user).any? end + desc "Deploy key with read access" + condition(:download_code_deploy_key) do + user.is_a?(DeployKey) && user.has_access_to?(project) + end + + desc "Deploy key with write access" + condition(:push_code_deploy_key) do + user.is_a?(DeployKey) && user.can_push_to?(project) + end + desc "Deploy token with read_package_registry scope" condition(:read_package_registry_deploy_token) do user.is_a?(DeployToken) && user.has_access_to?(project) && user.read_package_registry @@ -616,6 +626,14 @@ class ProjectPolicy < BasePolicy prevent :move_design end + rule { download_code_deploy_key }.policy do + enable :download_code + end + + rule { push_code_deploy_key }.policy do + enable :push_code + end + rule { read_package_registry_deploy_token }.policy do enable :read_package enable :read_project |