blob: 1f72aaa4775ba93190aef2dd8dd98b8d512c1a08 (
plain)
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
before_action :authorize_read_cluster_agent!
before_action :set_kas_cookie, only: [:show], if: -> { current_user }
feature_category :deployment_management
def show
head :ok
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
|