Sha256: fb9cc747127a226e34512edd75295feb1fa911d46175ae0032b8aac4475e8737

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

module Vidibus
  module User
    module Extensions
      module Helper

        # Accessor for the warden proxy instance.
        def warden
          request.env['warden']
        end

        # Returns the user that is currently logged in.
        def current_user
          warden.user
        end

        # Returns the session of the currently signed-in user.
        def user_session
          warden.session if current_user
        end

        # Returns true if user is logged in.
        def authenticated?
          warden.authenticated?
        end
        alias :signed_in? :authenticated?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vidibus-user-1.0.1 lib/vidibus/user/extensions/helper.rb
vidibus-user-1.0.0 lib/vidibus/user/extensions/helper.rb