module FatFreeCRM::Permissions::ClassMethods

Public Instance Methods

uses_user_permissions() click to toggle source
# 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