关联了项目的作业附件提交不了

This commit is contained in:
z9hang 2014-11-24 10:06:34 +08:00
parent 3784149112
commit 79e37fbf2c
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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"