mirror of
https://github.com/redmine/redmine.git
synced 2026-03-06 04:21:23 +01:00
Edit attachments after upload (#1326).
git-svn-id: http://svn.redmine.org/redmine/trunk@13665 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -27,6 +27,7 @@ module Redmine
|
||||
cattr_accessor :attachable_options
|
||||
self.attachable_options = {}
|
||||
attachable_options[:view_permission] = options.delete(:view_permission) || "view_#{self.name.pluralize.underscore}".to_sym
|
||||
attachable_options[:edit_permission] = options.delete(:edit_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
|
||||
attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
|
||||
|
||||
has_many :attachments, lambda {order("#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC")},
|
||||
@@ -46,6 +47,11 @@ module Redmine
|
||||
user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
|
||||
end
|
||||
|
||||
def attachments_editable?(user=User.current)
|
||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||
user.allowed_to?(self.class.attachable_options[:edit_permission], self.project)
|
||||
end
|
||||
|
||||
def attachments_deletable?(user=User.current)
|
||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||
user.allowed_to?(self.class.attachable_options[:delete_permission], self.project)
|
||||
|
||||
Reference in New Issue
Block a user