Sha256: 0dcd59004bd459fd93a093b9c793154b1f1c95ee46dcd17b118d635963c67397

Contents?: true

Size: 1.78 KB

Versions: 7

Compression:

Stored size: 1.78 KB

Contents

require 'devise'
require 'devise_masquerade/version'
require 'devise_masquerade/routes'
require 'devise_masquerade/controllers/helpers'
require 'devise_masquerade/controllers/url_helpers'
require 'devise_masquerade/rails'

module Devise
  mattr_accessor :masquerade_param
  @@masquerade_param = 'masquerade'

  mattr_accessor :masquerade_expires_in
  @@masquerade_expires_in = 1.minute

  mattr_accessor :masquerade_key_size
  @@masquerade_key_size = 16

  mattr_accessor :masquerade_bypass_warden_callback
  @@masquerade_bypass_warden_callback = false

  mattr_accessor :masquerade_routes_back
  @@masquerade_routes_back = false

  # Example: Devise.masqueraded_resource_class = User
  mattr_accessor :masqueraded_resource_class

  # Example: Devise.masqueraded_resource_class_name = 'User'
  mattr_accessor :masqueraded_resource_class_name

  # Example: Devise.masqueraded_resource_name = :user
  mattr_accessor :masqueraded_resource_name

  # Example: Devise.masquerading_resource_class = AdminUser
  mattr_accessor :masquerading_resource_class

  # Example: Devise.masquerading_resource_class_name = 'AdminUser'
  mattr_accessor :masquerading_resource_class_name

  # Example: Devise.masquerading_resource_name = :admin_user
  mattr_accessor :masquerading_resource_name

  # Example: Devise.masquerade_storage_method = :session
  # - session
  # - cache
  mattr_accessor :masquerade_storage_method
  @@masquerade_storage_method = :session

  def self.masquerade_storage_method_session?
    Devise.masquerade_storage_method == :session
  end

  def self.masquerade_storage_method_cache?
    Devise.masquerade_storage_method == :cache
  end

  @@helpers << DeviseMasquerade::Controllers::Helpers
end

Devise.add_module :masqueradable, controller: :masquerades,
  model: 'devise_masquerade/models', route: :masquerade

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
devise_masquerade-2.1.3 lib/devise_masquerade.rb
devise_masquerade-2.1.2 lib/devise_masquerade.rb
devise_masquerade-2.1.0 lib/devise_masquerade.rb
devise_masquerade-2.0.3 lib/devise_masquerade.rb
devise_masquerade-2.0.2 lib/devise_masquerade.rb
devise_masquerade-2.0.1 lib/devise_masquerade.rb
devise_masquerade-2.0.0 lib/devise_masquerade.rb