diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /app/policies/deploy_key_policy.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'app/policies/deploy_key_policy.rb')
-rw-r--r-- | app/policies/deploy_key_policy.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/policies/deploy_key_policy.rb b/app/policies/deploy_key_policy.rb index b117bb57921..ccf1bda26bb 100644 --- a/app/policies/deploy_key_policy.rb +++ b/app/policies/deploy_key_policy.rb @@ -3,10 +3,14 @@ class DeployKeyPolicy < BasePolicy with_options scope: :subject, score: 0 condition(:private_deploy_key) { @subject.private? } + condition(:public_deploy_key) { @subject.public? } condition(:has_deploy_key) { @user.project_deploy_keys.any? { |pdk| pdk.id.eql?(@subject.id) } } rule { anonymous }.prevent_all - - rule { admin }.enable :update_deploy_key - rule { private_deploy_key & has_deploy_key }.enable :update_deploy_key + rule { public_deploy_key | admin | has_deploy_key }.policy do + enable :read_deploy_key + end + rule { admin | (private_deploy_key & has_deploy_key) }.policy do + enable :update_deploy_key + end end |