Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
daiao 5 years ago
commit 3bff674952

@ -220,22 +220,22 @@ class User < ApplicationRecord
# 课堂的老师(创建者、老师、助教) # 课堂的老师(创建者、老师、助教)
def teacher_of_course?(course) 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 end
# 课堂的老师(创建者、老师、助教),不用考虑当前身份 # 课堂的老师(创建者、老师、助教),不用考虑当前身份
def teacher_of_course_non_active?(course) 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 end
# 是否是教师,课堂管理员或者超级管理员 # 是否是教师,课堂管理员或者超级管理员
def teacher_or_admin?(course) 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 end
# 课堂的创建者(考虑到多重身份的用户) # 课堂的创建者(考虑到多重身份的用户)
def creator_of_course?(course) 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 end
# 课堂的学生 # 课堂的学生

Loading…
Cancel
Save