sw_1用户访问875班级却报403

This commit is contained in:
cxt 2017-01-20 11:16:35 +08:00
parent ac80805932
commit 2995c05b06
2 changed files with 6 additions and 1 deletions

View File

@ -352,7 +352,9 @@ class MembersController < ApplicationController
role_ids = attrs.delete(:role_ids)
if role_ids && role_ids.include?("10")
StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id)
if StudentsForCourse.where(:student_id => @member.user_id, :course_id =>@course.id).blank?
StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id)
end
else
joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
joined.each do |join|

View File

@ -55,6 +55,9 @@ class Member < ActiveRecord::Base
if (new_role_ids.include?(7) || new_role_ids.include?(9)) && role_ids.include?(10)
member_roles.where("role_id = 10").first.update_column('is_current', 0)
end
if ids.include?(10) && !ids.include?(7) && !ids.include?(9) && role_ids.include?(10)
member_roles.where("role_id = 10").first.update_column('is_current', 1)
end
# Add new roles
if new_role_ids.include?(7) && new_role_ids.include?(10)
member_roles << MemberRole.new(:role_id => 7)