Module: FatFreeCRM::Permissions::ClassMethods

Defined in:
lib/fat_free_crm/permissions.rb

Instance Method Summary collapse

Instance Method Details

#uses_user_permissionsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fat_free_crm/permissions.rb', line 15

def uses_user_permissions
  unless included_modules.include?(InstanceMethods)
    #
    # NOTE: we're deliberately omitting :dependent => :destroy to preserve
    # permissions of deleted objects. This serves two purposes: 1) to be able
    # to implement Recycle Bin/Restore and 2) to honor permissions when
    # displaying "object deleted..." in the activity log.
    #
    has_many :permissions, as: :asset

    scope :my, ->(current_user) { accessible_by(current_user.ability) }

    include FatFreeCRM::Permissions::InstanceMethods
    extend FatFreeCRM::Permissions::SingletonMethods
  end
end