Sha256: 2941cecbfa609dd890cf1fe633282d0777fab808fc3a31edd5159efa03dd98ea

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

module Authpds
  module Session
    module Record
      # Get the record associated with this PDS user.
      def get_record(login)
        record = (klass.find_by_smart_case_login_field(login) || klass.new(login_field => login))
      end

      # Set the record information associated with this PDS user.
      def set_record
        self.attempted_record = get_record(pds_user.send(pds_record_identifier))
        self.attempted_record.expiration_date = expiration_date
        # Do this part only if user data has expired.
        reset_record attempted_record if self.attempted_record.expired?
        self.attempted_record.user_attributes= additional_attributes
      end

      # Reset expired data
      def reset_record(attempted_record)
        pds_attributes.each do |record_attr, pds_attr|
          attempted_record.send("#{record_attr}=".to_sym,
            pds_user.send(pds_attr.to_sym)) if self.attempted_record.respond_to?("#{record_attr}=".to_sym)
        end
        pds_user.class.public_instance_methods(false).each do |pds_attr_reader|
          attempted_record.user_attributes = {
            pds_attr_reader.to_sym => pds_user.send(pds_attr_reader.to_sym) }
        end
      end
      private :reset_record
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
authpds-0.2.9 lib/authpds/session/record.rb
authpds-0.2.8 lib/authpds/session/record.rb
authpds-0.2.7 lib/authpds/session/record.rb
authpds-0.2.6 lib/authpds/session/record.rb
authpds-0.2.5 lib/authpds/session/record.rb
authpds-0.2.4 lib/authpds/session/record.rb
authpds-0.2.3 lib/authpds/session/record.rb
authpds-0.2.2 lib/authpds/session/record.rb
authpds-0.2.1 lib/authpds/session/record.rb