From 79e37fbf2ce4f92ce3cc3b0c8a219e384b6bdc28 Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 24 Nov 2014 10:06:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E8=81=94=E4=BA=86=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E9=99=84=E4=BB=B6=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=B8=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 3 +-- db/schema.rb | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 5c3503718..6572e079d 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -64,7 +64,7 @@ class AttachmentsController < ApplicationController # modify by nwb # 下载添加权限设置 candown = false - if (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project + if @attachment.container.class.to_s != "HomeworkAttach" &&(@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) @@ -89,7 +89,6 @@ class AttachmentsController < ApplicationController elsif @attachment.container_type == "Bid" && @attachment.container && @attachment.container.courses candown = User.current.member_of_course?(@attachment.container.courses.first) || (course.is_public == 1 && @attachment.is_public == 1) else - candown = @attachment.is_public == 1 end if candown || User.current.admin? || User.current.id == @attachment.author_id diff --git a/db/schema.rb b/db/schema.rb index 2e664eaa7..973e2afbe 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20141119011439) do +ActiveRecord::Schema.define(:version => 20141120091234) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,6 +52,7 @@ ActiveRecord::Schema.define(:version => 20141119011439) do t.string "disk_directory" t.integer "attachtype", :default => 1 t.integer "is_public", :default => 1 + t.integer "copy_from" end add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"