From 70b5cc84f506546071aa48f2abe21db633254c8c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 20 Jul 2019 21:33:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 # 课堂的学生