From b3d2754415af6910cd97695e3506ed3d84aedfe2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 21 Jul 2015 10:52:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=89=88?= =?UTF-8?q?=E6=9C=AC=20=E7=AE=A1=E7=90=86=20=E5=8F=AF=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 64a478187..3e3718f7e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1850,6 +1850,8 @@ module ApplicationHelper candown = true elsif attachment.container.class.to_s=="StudentWork" candown = true + elsif attachment.container.class.to_s=="PhoneAppVersion" + candown = true elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses course = attachment.container.courses.first candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1) From 28ca4d2be2921f3f475d1a16e94a368e86f6a26d Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 21 Jul 2015 11:59:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=89=88?= =?UTF-8?q?=E6=9C=AC=20=E7=AE=A1=E7=90=86=20=E5=8F=AF=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index a301a1e6c..d5b0a25bf 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -514,6 +514,8 @@ private end def has_login - render_403 unless User.current.logged? + unless @attachment.container_type == "PhoneAppVersion" + render_403 unless User.current.logged? + end end end From 6f773b902b138f0aa235194cfd4921d815ee5349 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 21 Jul 2015 11:59:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=89=88?= =?UTF-8?q?=E6=9C=AC=20=E7=AE=A1=E7=90=86=20=E5=8F=AF=E4=BB=A5=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3e3718f7e..165e22071 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1824,7 +1824,9 @@ module ApplicationHelper def attachment_candown attachment candown = false 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 candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1) elsif attachment.container.is_a?(Project) @@ -1850,8 +1852,7 @@ module ApplicationHelper candown = true elsif attachment.container.class.to_s=="StudentWork" candown = true - elsif attachment.container.class.to_s=="PhoneAppVersion" - candown = true + elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses course = attachment.container.courses.first candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)