From 89abbabeca60902c95972be4500840e46e7f7695 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 22 Nov 2019 17:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/weapps/courses_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb index 8716e6b28..f35b0591a 100644 --- a/app/controllers/weapps/courses_controller.rb +++ b/app/controllers/weapps/courses_controller.rb @@ -1,6 +1,6 @@ class Weapps::CoursesController < Weapps::BaseController before_action :require_login - before_action :user_course_identity, except: [:create] + before_action :set_course, :user_course_identity, except: [:create] before_action :teacher_allowed, only: [:edit, :update] before_action :teacher_or_admin_allowed, only: [:change_member_roles, :delete_course_teachers] @@ -167,4 +167,9 @@ class Weapps::CoursesController < Weapps::BaseController tip_exception(403, "..") end end + + def set_course + @course = Course.find_by!(id: params[:id]) + tip_exception(404, "") if @course.is_delete == 1 && !current_user.admin? + end end \ No newline at end of file