|
|
@ -1119,7 +1119,7 @@ class User < Principal
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def member_of_course?(course)
|
|
|
|
def member_of_course?(course)
|
|
|
|
courses.to_a.include?(course)
|
|
|
|
courses.to_a.include?(course) || User.current.business?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def member_of_contest?(contest)
|
|
|
|
def member_of_contest?(contest)
|
|
|
@ -1323,7 +1323,7 @@ class User < Principal
|
|
|
|
if Project === context
|
|
|
|
if Project === context
|
|
|
|
return false unless context.allows_to?(action)
|
|
|
|
return false unless context.allows_to?(action)
|
|
|
|
# Admin users are authorized for anything else
|
|
|
|
# Admin users are authorized for anything else
|
|
|
|
return true if admin?
|
|
|
|
return true if admin? || business?
|
|
|
|
|
|
|
|
|
|
|
|
# 课程:作品关联项目的老师也可以访问私有项目
|
|
|
|
# 课程:作品关联项目的老师也可以访问私有项目
|
|
|
|
course_ids = context.student_work_projects.blank? ? "(-1)" : "(" + context.student_work_projects.map{|swp| swp.course_id}.join(",") + ")"
|
|
|
|
course_ids = context.student_work_projects.blank? ? "(-1)" : "(" + context.student_work_projects.map{|swp| swp.course_id}.join(",") + ")"
|
|
|
|