acts_as_attachable.rb.patch

Patch for acts_as_attachable.rb - Andriy Lesyuk, 2011-04-08 23:09

Download (1.03 KB)

View differences:

acts_as_attachable.rb 2011-03-11 23:35:58.000000000 +0200
44 44
        end
45 45
        
46 46
        def attachments_visible?(user=User.current)
47
          user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
47
          if self.project
48
            user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
49
          else
50
            user.allowed_to?(self.class.attachable_options[:view_permission], nil, :global => true)
51
          end
48 52
        end
49 53
        
50 54
        def attachments_deletable?(user=User.current)
51
          user.allowed_to?(self.class.attachable_options[:delete_permission], self.project)
55
          if self.project
56
            user.allowed_to?(self.class.attachable_options[:delete_permission], self.project)
57
          else
58
            user.allowed_to?(self.class.attachable_options[:delete_permission], nil, :global => true)
59
          end
52 60
        end
53 61

  
54 62
        def initialize_unsaved_attachments