1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
# frozen_string_literal: true
module Clusters
module Agents
class DashboardController < ApplicationController
include KasCookie
before_action :check_feature_flag!
before_action :find_agent, only: [:show], if: -> { current_user }
before_action :authorize_read_cluster_agent!, only: [:show], if: -> { current_user }
before_action :set_kas_cookie, only: [:show], if: -> { current_user }
feature_category :deployment_management
def index; end
def show; end
private
def find_agent
@agent = ::Clusters::Agent.find(params[:agent_id])
end
def check_feature_flag!
not_found unless ::Feature.enabled?(:k8s_dashboard, current_user)
end
def authorize_read_cluster_agent!
not_found unless can?(current_user, :read_cluster_agent, @agent)
end
end
end
end
|