修改老师无法修改班级成员角色的BUG

This commit is contained in:
yuanke 2016-09-01 14:10:27 +08:00
parent a6241afe04
commit 7c928703b5
1 changed files with 11 additions and 5 deletions

View File

@ -569,14 +569,20 @@ module Mobile
roles_id << 10
end
c = Course.find("#{params[:id]}")
#7教辅 9教师 10学生
if c.tea_id == params[:user_id] || c.tea_id != current_user.id || roles_id.length <= 0
present :status, -1
else
my_member = c.member_principals.where("users.id=#{current_user.id}").first
rolesids = []
my_member.roles.each do |role|
rolesids << role.id
end
#7教辅 9教师 10学生
if c.tea_id == params[:user_id] || roles_id.length <= 0 || rolesids.include?(10)
present :status, -1
present :message,"修改失败"
else
cs = CoursesService.new
status = cs.modify_user_course_role params,roles_id
present :status, status