私有项目的资源数,只要不是本人传的,都看不到

This commit is contained in:
lizanle 2015-03-26 15:23:34 +08:00
parent 297b3c42b1
commit 90bce76409
1 changed files with 4 additions and 1 deletions

View File

@ -87,7 +87,10 @@ module FilesHelper
def visable_attachemnts attachments
result = []
attachments.each do |attachment|
if attachment.is_public? || (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
if attachment.is_public? ||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
attachment.author_id == User.current.id
result << attachment
end
end