Sha256: 282262b4b247c9fe38a3c03c591fe0dd523d592574b71248f1d3fe296f8130d5

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

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)
        warder.set_user user
      end
      alias_method :current_user=, :user=
    end # Helper Methods
    
    module ControllerOnlyMethods
      # Logout the current user
      # :api: public
      def logout(*args)
        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

2 entries across 2 versions & 2 rubygems

Version Path
hassox-rails_warden-0.2.0 lib/rails_warden/controller_mixin.rb
rails_warden-0.2.0 lib/rails_warden/controller_mixin.rb