Sha256: 27aca16de7a6f28ae88e5de6849eef21eeac98fbb41caf3a706c088c18a307b9

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

# encoding: utf-8
module RailsWarden
  module Mixins
    module HelperMethods
      # The main accessor for the warden proxy instance
      # :api: public
      def warden
        request.env['warden']
      end

      # Proxy to the authenticated? method on warden
      # :api: public
      def authenticated?(*args)
        warden.authenticated?(*args)
      end
      alias_method :logged_in?, :authenticated?

      # Access the currently logged in user
      # :api: public
      def user(*args)
        warden.user(*args)
      end
      alias_method :current_user, :user

      def user=(user)
        warden.set_user user
      end
      alias_method :current_user=, :user=
    end # Helper Methods

    module ControllerOnlyMethods
      # Logout the current user
      # :api: public
      def logout(*args)
        warden.raw_session.inspect  # Without this inspect here.  The session does not clear :|
        warden.logout(*args)
      end

      # Proxy to the authenticate method on warden
      # :api: public
      def authenticate(*args)
        warden.authenticate(*args)
      end

      # Proxy to the authenticate method on warden
      # :api: public
      def authenticate!(*args)
        warden.authenticate!(*args)
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
hassox-rails_warden-0.2.4 lib/rails_warden/controller_mixin.rb
rails_warden-0.5.5 lib/rails_warden/controller_mixin.rb
rails_warden-0.5.4 lib/rails_warden/controller_mixin.rb
rails_warden-0.5.3 lib/rails_warden/controller_mixin.rb
rails_warden-0.5.2 lib/rails_warden/controller_mixin.rb
rails_warden-0.5.1 lib/rails_warden/controller_mixin.rb
rails_warden-0.5.0 lib/rails_warden/controller_mixin.rb
rails_warden-0.3.0 lib/rails_warden/controller_mixin.rb
rails_warden-0.2.6 lib/rails_warden/controller_mixin.rb
rails_warden-0.2.5 lib/rails_warden/controller_mixin.rb
rails_warden-0.2.4 lib/rails_warden/controller_mixin.rb