点击在线问卷时若未登录则直接跳到登录页面

This commit is contained in:
cxt 2016-01-19 15:41:53 +08:00
parent 8e9c4bab6b
commit e293805488
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@
class PollController < ApplicationController class PollController < ApplicationController
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll] before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
before_filter :find_container, :only => [:new,:create, :index] before_filter :find_container, :only => [:new,:create, :index]
before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result]
before_filter :is_member_of_course, :only => [:index,:show,:poll_result] before_filter :is_member_of_course, :only => [:index,:show,:poll_result]
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll] before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll]
include PollHelper include PollHelper
@ -503,6 +504,10 @@ class PollController < ApplicationController
end end
end end
def is_logged
redirect_to signin_path unless User.current.logged?
end
def is_member_of_course def is_member_of_course
render_403 unless(@course && (User.current.member_of_course?(@course) || User.current.admin?)) render_403 unless(@course && (User.current.member_of_course?(@course) || User.current.admin?))
end end