资源调整

dev_winse
cxt 6 years ago
parent b41d127635
commit 93eac23c58

@ -162,28 +162,30 @@ class AttachmentsController < ApplicationController
def attachment_candown def attachment_candown
unless current_user.admin? || current_user.business? unless current_user.admin? || current_user.business?
candown = true candown = true
if @file.container && current_user.logged? unless params[:type] == 'history'
# 课堂资源、作业、毕设相关资源的权限判断 if @file.container && current_user.logged?
if @file.container.is_a?(Course) # 课堂资源、作业、毕设相关资源的权限判断
course = @file.container if @file.container.is_a?(Course)
candown = current_user.member_of_course?(course) || @file.is_public == 1 course = @file.container
elsif @file.container.is_a?(HomeworkCommon) || @file.container.is_a?(GraduationTask) || @file.container.is_a?(GraduationTopic) candown = current_user.member_of_course?(course) || @file.is_public == 1
course = @file.container&.course elsif @file.container.is_a?(HomeworkCommon) || @file.container.is_a?(GraduationTask) || @file.container.is_a?(GraduationTopic)
candown = current_user.member_of_course?(course) course = @file.container&.course
elsif @file.container.is_a?(StudentWork) candown = current_user.member_of_course?(course)
course = @file.container&.homework_common&.course elsif @file.container.is_a?(StudentWork)
candown = current_user.member_of_course?(course) course = @file.container&.homework_common&.course
elsif @file.container.is_a?(StudentWorksScore) candown = current_user.member_of_course?(course)
course = @file.container&.student_work&.homework_common&.course elsif @file.container.is_a?(StudentWorksScore)
candown = current_user.member_of_course?(course) course = @file.container&.student_work&.homework_common&.course
elsif @file.container.is_a?(GraduationWork) candown = current_user.member_of_course?(course)
course = @file.container&.graduation_task&.course elsif @file.container.is_a?(GraduationWork)
candown = current_user.member_of_course?(course) course = @file.container&.graduation_task&.course
elsif @file.container.is_a?(GraduationWorkScore) candown = current_user.member_of_course?(course)
course = @file.container&.graduation_work&.graduation_task&.course elsif @file.container.is_a?(GraduationWorkScore)
candown = current_user.member_of_course?(course) course = @file.container&.graduation_work&.graduation_task&.course
candown = current_user.member_of_course?(course)
end
tip_exception(403, "您没有权限进入") if course.present? && !candown
end end
tip_exception(403, "您没有权限进入") if course.present? && !candown
end end
end end
end end

Loading…
Cancel
Save