debian-mirror-gitlab/app/graphql/resolvers/clusters/agent_activity_events_resolver.rb

26 lines
541 B
Ruby
Raw Normal View History

2022-01-26 12:08:38 +05:30
# frozen_string_literal: true
module Resolvers
module Clusters
class AgentActivityEventsResolver < BaseResolver
type Types::Clusters::AgentActivityEventType, null: true
alias_method :agent, :object
delegate :project, to: :agent
def resolve(**args)
return ::Clusters::Agents::ActivityEvent.none unless can_view_activity_events?
agent.activity_events
end
private
def can_view_activity_events?
current_user.can?(:admin_cluster, project)
end
end
end
end