You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/ecs/course_managers_controller.rb

20 lines
659 B

6 years ago
class Ecs::CourseManagersController < Ecs::CourseBaseController
skip_before_action :check_user_permission!, only: [:create, :destroy]
before_action :check_major_manager_permission!, only: [:create, :destroy]
def create
@user = Ecs::CreateCourseManagerService.call(current_course, params[:user_id])
rescue Ecs::CreateCourseManagerService::Error => ex
render_error(ex.message)
end
def destroy
# params[:id] 为 user_id
manager = current_course.ec_course_users.find_by(user_id: params[:id])
return render_error('不存在该课程管理员!') if manager.blank?
manager.destroy!
render_ok
end
end