From cce35c89ff26dbaad9a0e055d3bc7d70987bec84 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 11 Oct 2019 15:31:39 +0800 Subject: [PATCH 1/2] tiaoz --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a3b20c598..bab8a4189 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -552,7 +552,7 @@ class CoursesController < ApplicationController def change_member_role tip_exception("请至少选择一个角色") if params[:roles].blank? tip_exception("不能具有老师、助教两种角色") if params[:roles].include?("PROFESSOR") && params[:roles].include?("ASSISTANT_PROFESSOR") - tip_exception("管理员不能切换为助教或老师") if @user_course_identity == Course::CREATOR && + tip_exception("管理员不能切换为助教或老师") if current_user.id == @course.tea_id && (params[:roles].include?("PROFESSOR") || params[:roles].include?("ASSISTANT_PROFESSOR")) course_members = @course.course_members.where(user_id: params[:user_id]) From 450e9675348a085b852311cf25cce9b7b3bf4532 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 11 Oct 2019 15:32:09 +0800 Subject: [PATCH 2/2] tiaoz --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index bab8a4189..0c643d15c 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -552,7 +552,7 @@ class CoursesController < ApplicationController def change_member_role tip_exception("请至少选择一个角色") if params[:roles].blank? tip_exception("不能具有老师、助教两种角色") if params[:roles].include?("PROFESSOR") && params[:roles].include?("ASSISTANT_PROFESSOR") - tip_exception("管理员不能切换为助教或老师") if current_user.id == @course.tea_id && + tip_exception("管理员不能切换为助教或老师") if params[:user_id].to_i == @course.tea_id && (params[:roles].include?("PROFESSOR") || params[:roles].include?("ASSISTANT_PROFESSOR")) course_members = @course.course_members.where(user_id: params[:user_id])