Sha256: f00029dbc1f83b66ed5b04175418cdc3a370c2f588cb278028acfabd37d96c2c

Contents?: true

Size: 767 Bytes

Versions: 1

Compression:

Stored size: 767 Bytes

Contents

require 'dm-serializer'
module Ixtlan
  module Models
    class Authentication
      include DataMapper::Resource

      def self.name
        "Authentication"
      end

      property :id, Serial, :default => 1

      property :login, String,:format => /^[a-zA-Z0-9\-!=+$%^&*\(\){}|\[\]<>_.]*$/

      property :password, String,:format => /^[a-zA-Z0-9_.]*$/

      attr_accessor :token

      belongs_to :user, :model => ::Ixtlan::Models::USER

      if protected_instance_methods.find {|m| m == 'to_x'}.nil?

        protected

        alias :to_x :to_xml_document
        def to_xml_document(opts, doc = nil)
          opts.merge!({:exclude => [:password,:user_id], :methods => [:token, :user]})
          to_x(opts, doc)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ixtlan-0.3.0 lib/ixtlan/models/authentication.rb