|
|
@ -121,7 +121,8 @@ module FilesHelper
|
|
|
|
def visable_attachemnts attachments
|
|
|
|
def visable_attachemnts attachments
|
|
|
|
result = []
|
|
|
|
result = []
|
|
|
|
attachments.each do |attachment|
|
|
|
|
attachments.each do |attachment|
|
|
|
|
if attachment.is_public? ||
|
|
|
|
if (attachment.is_public? && attachment.container_type != "Course") ||
|
|
|
|
|
|
|
|
(attachment.is_public? && attachment.container_type == "Course" && attachment.is_publish == 1)||
|
|
|
|
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
|
|
|
|
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
|
|
|
|
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
|
|
|
|
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
|
|
|
|
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
|
|
|
|
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
|
|
|
|