summaryrefslogtreecommitdiff
path: root/app/controllers/ci/variables_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/ci/variables_controller.rb')
-rw-r--r--app/controllers/ci/variables_controller.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/controllers/ci/variables_controller.rb b/app/controllers/ci/variables_controller.rb
new file mode 100644
index 00000000000..6908e0877f0
--- /dev/null
+++ b/app/controllers/ci/variables_controller.rb
@@ -0,0 +1,33 @@
+module Ci
+ class VariablesController < Ci::ApplicationController
+ before_filter :authenticate_user!
+ before_filter :project
+ before_filter :authorize_access_project!
+ before_filter :authorize_manage_project!
+
+ layout 'ci/project'
+
+ def show
+ end
+
+ def update
+ if project.update_attributes(project_params)
+ Ci::EventService.new.change_project_settings(current_user, project)
+
+ redirect_to ci_project_variables_path(project), notice: 'Variables were successfully updated.'
+ else
+ render action: 'show'
+ end
+ end
+
+ private
+
+ def project
+ @project ||= Ci::Project.find(params[:project_id])
+ end
+
+ def project_params
+ params.require(:project).permit({ variables_attributes: [:id, :key, :value, :_destroy] })
+ end
+ end
+end