huang 10 years ago
commit b05478e71d

@ -514,6 +514,8 @@ private
end end
def has_login def has_login
unless @attachment.container_type == "PhoneAppVersion"
render_403 unless User.current.logged? render_403 unless User.current.logged?
end end
end
end end

@ -1824,7 +1824,9 @@ module ApplicationHelper
def attachment_candown attachment def attachment_candown attachment
candown = false candown = false
if attachment.container if attachment.container
if attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project if attachment.container.class.to_s=="PhoneAppVersion"
candown = true
elsif attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
project = attachment.container.project project = attachment.container.project
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1) candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
elsif attachment.container.is_a?(Project) elsif attachment.container.is_a?(Project)
@ -1850,6 +1852,7 @@ module ApplicationHelper
candown = true candown = true
elsif attachment.container.class.to_s=="StudentWork" elsif attachment.container.class.to_s=="StudentWork"
candown = true candown = true
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
course = attachment.container.courses.first course = attachment.container.courses.first
candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1) candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)

Loading…
Cancel
Save