From 7c928703b5c06a769d889ac89cd0acb5801ba6e7 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 1 Sep 2016 14:10:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=81=E5=B8=88=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BA=A7=E6=88=90=E5=91=98?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index b5af07a09..a42ebd470 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -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