课程、项目讨论区添加删除自己上传的附件功能
This commit is contained in:
parent
9217351b1c
commit
de8e3e5fac
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue