From d76aa7cab2c5ae6b87c400f5315ff12a93e77851 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 18 Jun 2015 09:31:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E8=AF=BE=E7=A8=8B=E6=88=90=E5=91=98?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E8=AE=BF=E9=97=AE=E8=AF=BE=E7=A8=8B=E7=9A=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 06bc1fd38..d5e62127d 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -3,6 +3,7 @@ class HomeworkCommonController < ApplicationController before_filter :find_course, :only => [:index,:new,:create] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] + before_filter :member_of_course, :only => [:index] def index homeworks = @course.homework_commons.order("created_at desc") @@ -203,6 +204,11 @@ class HomeworkCommonController < ApplicationController render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin? end + #当前用户是不是课程的成员 + def member_of_course + render_403 unless User.current.member_of_course?(@course) || User.current.admin? + end + def get_assigned_homeworks(student_works, n, index) student_works += student_works student_works[index + 1 .. index + n]