diff options
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/clusters/agent_policy.rb | 10 |
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 |