Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-26 09:09:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-26 09:09:25 +0300
commit8759459c84757589002830279dfe3872ffc852bd (patch)
treec7eb8b77a10db86f7cead8301d21650e628021d8 /app/policies
parent77da08b6e8159daae9b352082bad0c55a003994f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/clusters/agent_policy.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/policies/clusters/agent_policy.rb b/app/policies/clusters/agent_policy.rb
index 25e78c84802..afacf782a76 100644
--- a/app/policies/clusters/agent_policy.rb
+++ b/app/policies/clusters/agent_policy.rb
@@ -5,5 +5,15 @@ module Clusters
alias_method :cluster_agent, :subject
delegate { cluster_agent.project }
+
+ # This condition is more expensive than the same permission check in ProjectPolicy,
+ # so having a higher score.
+ condition(:ci_access_authorized_agent, score: 10) do
+ @subject.ci_access_authorized_for?(@user)
+ end
+
+ rule { ci_access_authorized_agent }.policy do
+ enable :read_cluster_agent
+ end
end
end