diff --git a/app/models/user.rb b/app/models/user.rb index 299ad1ff4..73036c73e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -220,22 +220,22 @@ class User < ApplicationRecord # 课堂的老师(创建者、老师、助教) def teacher_of_course?(course) - course.course_members.exists?(user_id: id, role: [1,2,3], is_active: 1) || admin? + course.course_members.exists?(user_id: id, role: [1,2,3], is_active: 1) || admin? || business? end # 课堂的老师(创建者、老师、助教),不用考虑当前身份 def teacher_of_course_non_active?(course) - course.course_members.exists?(user_id: id, role: [1,2,3]) || admin? + course.course_members.exists?(user_id: id, role: [1,2,3]) || admin? || business? end # 是否是教师,课堂管理员或者超级管理员 def teacher_or_admin?(course) - course.course_members.exists?(user_id: id, role: [1,2], is_active: 1) || admin? + course.course_members.exists?(user_id: id, role: [1,2], is_active: 1) || admin? || business? end # 课堂的创建者(考虑到多重身份的用户) def creator_of_course?(course) - course.course_members.exists?(user_id: id, role: 1, is_active: 1) || admin? + course.course_members.exists?(user_id: id, role: 1, is_active: 1) || admin? || business? end # 课堂的学生