diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index cfe4d155..39324272 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -11,6 +11,10 @@ class ExercisesController < ApplicationController before_action :set_file_types, only: [:create, :edit, :new, :update] before_action :set_teams, only: [:create, :edit, :new, :update] + skip_before_filter :verify_authenticity_token, only: [:import_thin_common_cartridge] + skip_after_action :verify_authorized, only: [:import_thin_common_cartridge] + skip_after_action :verify_policy_scoped, only: [:import_thin_common_cartridge] + def authorize! authorize(@exercise || @exercises) end @@ -62,6 +66,12 @@ class ExercisesController < ApplicationController def edit end + def import_thin_common_cartridge + logger.info(request.headers['Authorization']) + logger.info(request.headers['Authorisation']) + render :nothing => true, :status => 200, :content_type => 'text/html' + end + def exercise_params params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :hide_file_tree, :team_id, :title, files_attributes: file_attributes).merge(user_id: current_user.id, user_type: current_user.class.name) end diff --git a/config/routes.rb b/config/routes.rb index 4b9c5dc2..5c8a8c34 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -41,6 +41,8 @@ Rails.application.routes.draw do resources :hints end + post '/thin_common_cartridge' => 'exercises#import_thin_common_cartridge' + resources :exercises do collection do match '', to: 'exercises#batch_update', via: [:patch, :put]