diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-13 12:08:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-13 12:08:37 +0300 |
commit | 0e65189f85bb393e16e60335a42933beb0834295 (patch) | |
tree | ce5160a3dd1ec3c06999d847783f5372c7b312fb /app/policies/project_policy.rb | |
parent | 2c1525618498a2aab2eed6a36f5045ce3f93ac6f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies/project_policy.rb')
-rw-r--r-- | app/policies/project_policy.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index a5813124bb1..1529ff07005 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -84,6 +84,16 @@ class ProjectPolicy < BasePolicy project.merge_requests_allowing_push_to_user(user).any? 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 + end + + desc "Deploy token with write_package_registry scope" + condition(:write_package_registry_deploy_token) do + user.is_a?(DeployToken) && user.has_access_to?(project) && user.write_package_registry + end + with_scope :subject condition(:forking_allowed) do @subject.feature_available?(:forking, @user) @@ -532,6 +542,16 @@ class ProjectPolicy < BasePolicy prevent :destroy_design end + rule { read_package_registry_deploy_token }.policy do + enable :read_package + enable :read_project + end + + rule { write_package_registry_deploy_token }.policy do + enable :create_package + enable :read_project + end + private def team_member? |