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