Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/clusters/base_controller.rb')
-rw-r--r--app/controllers/clusters/base_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/clusters/base_controller.rb b/app/controllers/clusters/base_controller.rb
index e7b76b87ad9..495b6463383 100644
--- a/app/controllers/clusters/base_controller.rb
+++ b/app/controllers/clusters/base_controller.rb
@@ -4,6 +4,7 @@ class Clusters::BaseController < ApplicationController
include RoutableActions
skip_before_action :authenticate_user!
+ before_action :clusterable
before_action :authorize_admin_cluster!, except: [:show, :index, :new, :authorize_aws_role, :update]
helper_method :clusterable
@@ -41,6 +42,11 @@ class Clusters::BaseController < ApplicationController
access_denied! unless can?(current_user, :read_prometheus, clusterable)
end
+ # For Group/Clusters and Project/Clusters, the clusterable object (group or project)
+ # is fetched through `find_routable!`, which calls a `render_404` if the user does not have access to the object
+ # The `clusterable` method will need to be in its own before_action call before the `authorize_*` calls
+ # so that the call stack will not proceed to the `authorize_*` calls
+ # and instead just render a not found page after the `clusterable` call
def clusterable
raise NotImplementedError
end