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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 21:08:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 21:08:58 +0300
commit1ca9950d5f890cd8f185e1eda158b969a7244fe2 (patch)
tree6f62715938a4b2b001705c51c697609a8e0850ae /app/controllers/projects/serverless
parentbcc77054ee9aefd1e332e04a4189390fd5a3112e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/serverless')
-rw-r--r--app/controllers/projects/serverless/functions_controller.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/controllers/projects/serverless/functions_controller.rb b/app/controllers/projects/serverless/functions_controller.rb
index 4b0d001fca6..0b55414d390 100644
--- a/app/controllers/projects/serverless/functions_controller.rb
+++ b/app/controllers/projects/serverless/functions_controller.rb
@@ -8,11 +8,15 @@ module Projects
def index
respond_to do |format|
format.json do
- functions = finder.execute
+ functions = finder.execute.select do |function|
+ can?(@current_user, :read_cluster, function.cluster)
+ end
+
+ serialized_functions = serialize_function(functions)
render json: {
knative_installed: finder.knative_installed,
- functions: serialize_function(functions)
+ functions: serialized_functions
}.to_json
end
@@ -23,11 +27,14 @@ module Projects
end
def show
- @service = serialize_function(finder.service(params[:environment_id], params[:id]))
- @prometheus = finder.has_prometheus?(params[:environment_id])
+ function = finder.service(params[:environment_id], params[:id])
+ return not_found unless function && can?(@current_user, :read_cluster, function.cluster)
+ @service = serialize_function(function)
return not_found if @service.nil?
+ @prometheus = finder.has_prometheus?(params[:environment_id])
+
respond_to do |format|
format.json do
render json: @service