Sha256: 9dd366ae26b33cd25601e2441b78f6274f8c111e8003bb7e71155d08f254a583

Contents?: true

Size: 780 Bytes

Versions: 6

Compression:

Stored size: 780 Bytes

Contents

require "refinery/authentication/devise/authorisation_manager"

module RefineryAuthenticationDeviseActionControllerBaseDecoration
  def self.prepended(base)
    base.prepend_before_action :detect_authentication_devise_user!
  end

  protected
  def refinery_users_exist?
    Refinery::Authentication::Devise::Role[:refinery].users.any?
  end

  private
  def refinery_authorisation_manager
    @refinery_authorisation_manager ||= ::Refinery::Authentication::Devise::AuthorisationManager.new
  end

  def detect_authentication_devise_user!
    if current_authentication_devise_user
      refinery_authorisation_manager.set_user!(current_authentication_devise_user)
    end
  end
end

ActionController::Base.send :prepend, RefineryAuthenticationDeviseActionControllerBaseDecoration

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-authentication-devise-2.0.0 app/decorators/controllers/action_controller_base_decorator.rb
refinerycms-authentication-devise-1.0.4 app/decorators/controllers/action_controller_base_decorator.rb
refinerycms-authentication-devise-1.0.3 app/decorators/controllers/action_controller_base_decorator.rb
refinerycms-authentication-devise-1.0.2 app/decorators/controllers/action_controller_base_decorator.rb
refinerycms-authentication-devise-1.0.1 app/decorators/controllers/action_controller_base_decorator.rb
refinerycms-authentication-devise-1.0.0 app/decorators/controllers/action_controller_base_decorator.rb