Skip to content
Snippets Groups Projects

Add clusterAgents field to Project/Group/Security Dashboard GraphQL API

All threads resolved!
20 files
+ 241
9
Compare changes
  • Side-by-side
  • Inline
Files
20
@@ -4,8 +4,8 @@ module Clusters
class AgentsFinder
include FinderMethods
def initialize(project, current_user, params: {})
@project = project
def initialize(object, current_user, params: {})
@object = object
@current_user = current_user
@params = params
end
@@ -13,7 +13,7 @@ def initialize(project, current_user, params: {})
def execute
return ::Clusters::Agent.none unless can_read_cluster_agents?
agents = project.cluster_agents
agents = object.cluster_agents
agents = agents.with_name(params[:name]) if params[:name].present?
agents.ordered_by_name
@@ -21,10 +21,12 @@ def execute
private
attr_reader :project, :current_user, :params
attr_reader :object, :current_user, :params
def can_read_cluster_agents?
current_user.can?(:read_cluster, project)
current_user.can?(:read_cluster, object)
end
end
end
Clusters::AgentsFinder.prepend_mod_with('Clusters::AgentsFinder')
Loading