diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-10-01 20:30:32 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-10-01 20:30:32 +0900 |
commit | 5663b4808df787b1bcbf32ba54eccbb4c7537e25 (patch) | |
tree | db851b0b94ee77d493dc787f67fe63136dab4fef /app/controllers | |
parent | 2d1a77b8a3567cae61f73196918fe365d4fe9415 (diff) | |
download | gitlab-ce-5663b4808df787b1bcbf32ba54eccbb4c7537e25.tar.gz |
authorize in controller. validation in model.
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/clusters_controller.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 840c623e778..ebb17bca010 100644 --- a/app/controllers/projects/clusters_controller.rb +++ b/app/controllers/projects/clusters_controller.rb @@ -1,8 +1,7 @@ class Projects::ClustersController < Projects::ApplicationController before_action :cluster, except: [:login, :index, :new, :create] + before_action :authorize_admin_cluster! before_action :authorize_google_api, except: [:login] - # before_action :cluster_creation_lock, only: [:update, :destroy] - # before_action :authorize_admin_clusters! # TODO: Authentication def login begin @@ -67,9 +66,7 @@ class Projects::ClustersController < Projects::ApplicationController if cluster.destroy redirect_to project_clusters_path(project), status: 302 else - redirect_to project_clusters_path(project), - status: :forbidden, - alert: _("Failed to remove the cluster") + render :edit end end @@ -94,12 +91,4 @@ class Projects::ClustersController < Projects::ApplicationController def token_in_session @token_in_session ||= session[GoogleApi::CloudPlatform::Client.session_key_for_token] end - - def cluster_creation_lock - if cluster.on_creation? - redirect_to edit_project_cluster_path(project, cluster), - status: :forbidden, - alert: _("You can not modify cluster during creation") - end - end end |