优化公开资源的下载权限判断

This commit is contained in:
nwb 2014-07-21 17:29:30 +08:00
parent 5e462f1ae7
commit 774eed0dbf
1 changed files with 2 additions and 2 deletions

View File

@ -55,10 +55,10 @@ class AttachmentsController < ApplicationController
candown = false
if @attachment.container.has_attribute?(:project) && @attachment.container.project
project = @attachment.container.project
candown= User.current.member_of?(project) || (project.is_public==1 && @attachment.is_public == 1)
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif @attachment.container.is_a?(Project)
project = @attachment.container
candown= User.current.member_of?(project) || (project.is_public==1 && @attachment.is_public == 1)
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif @attachment.container.has_attribute?(:course) && @attachment.container.course
course = @attachment.container.course
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)