Sha256: 75fa66704ce1b9d1b5338f5b377726763dac13d88f9475145c56a6a3f7efd30e

Contents?: true

Size: 658 Bytes

Versions: 2

Compression:

Stored size: 658 Bytes

Contents

require 'dm-serializer'
module Ixtlan
  module Models
    class Permission

      include DataMapper::Resource

      def self.default_storage_name
        "Permission"
      end

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

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

      has n, :roles, :model => Models::ROLE

      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!({:methods => [:roles]})
          to_x(opts, doc)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ixtlan-0.4.0.pre lib/ixtlan/models/permission.rb
ixtlan-0.3.0 lib/ixtlan/models/permission.rb