From de8e3e5facfa4abc1388ce26ae4106669c39dee4 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 9 Oct 2014 11:23:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E4=B8=8A=E4=BC=A0=E7=9A=84=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index 3059c23c9..f6dc31c64 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -54,11 +54,13 @@ module Redmine def attachments_deletable?(user=User.current) if (self.has_attribute?(:course) ||self.has_attribute?(:course_id)) && self.course + #默认给予删除自己上传的附件的权限 (respond_to?(:visible?) ? visible?(user) : true) && - user.allowed_to?(self.class.attachable_options[:delete_permission], self.course) + (user.allowed_to?(self.class.attachable_options[:delete_permission], self.course) || (self.has_attribute?(:author_id) && self.author == user)) else + #默认给予删除自己上传的附件的权限 (respond_to?(:visible?) ? visible?(user) : true) && - user.allowed_to?(self.class.attachable_options[:delete_permission], self.project) + (user.allowed_to?(self.class.attachable_options[:delete_permission], self.project) || (self.has_attribute?(:author_id) && self.author == user)) end end