Sha256: 3ea7562b2344752a8e25420f87456a0d8572cc6c9e157aca46a2c19744c2e075

Contents?: true

Size: 590 Bytes

Versions: 15

Compression:

Stored size: 590 Bytes

Contents

module TkhAuthenticationHelper
  def self.included(base)
    base.send(:include, InstanceMethods)
    # base.before_filter :current_user
    # base.after_filter :my_method_2
  end

  module InstanceMethods
    # duplicated from action controller extension. there must be a better way
    def current_user
      @current_user ||= User.find_by!(auth_token: cookies[:auth_token]) if cookies[:auth_token]
    end

    # duplicated from action controller extension. there must be a better way
    def administrator?
      @administrator ||= current_user && current_user.admin?
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
tkh_authentication-0.9.17.2 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.17.1 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.17 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.16 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.15 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.14 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.13 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.12 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.11 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.10 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.9 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.8 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.7 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.6 lib/tkh_authentication/tkh_authentication_helper.rb
tkh_authentication-0.9.5 lib/tkh_authentication/tkh_authentication_helper.rb