Class LDAP::Schema
In: lib/ldap/schema.rb
Parent: Hash

Retrieve and process information pertaining to LDAP schemas.

Methods

attr   may   must   names   new   sup  

Public Class methods

[Source]

    # File lib/ldap/schema.rb, line 16
16:     def initialize(entry)
17:       if( entry )
18:         entry.each{|key,vals|
19:           self[key] = vals
20:         }
21:       end
22:     end

Public Instance methods

Return the list of attributes in object class oc that are of category at. at may be the string MUST, MAY or SUP.

[Source]

    # File lib/ldap/schema.rb, line 34
34:     def attr(oc,at)
35:       self['objectClasses'].each{|s|
36:         if( s =~ /NAME\s+'#{oc}'/ )
37:           case s
38:           when /#{at}\s+\(([\w\d_-\s\$]+)\)/i
39:             return $1.split("$").collect{|attr| attr.strip}
40:           when /#{at}\s+([\w\d_-]+)/i
41:             return $1.split("$").collect{|attr| attr.strip}
42:           end
43:         end
44:       }
45:       return nil
46:     end

Return the list of attributes that an entry with object class oc may possess.

[Source]

    # File lib/ldap/schema.rb, line 58
58:     def may(oc)
59:       attr(oc, "MAY")
60:     end

Return the list of attributes that an entry with object class oc must possess.

[Source]

    # File lib/ldap/schema.rb, line 51
51:     def must(oc)
52:       attr(oc, "MUST")
53:     end

Return the list of values related to the schema component given in key. See LDAP::Conn#schema for common values of key.

[Source]

    # File lib/ldap/schema.rb, line 27
27:     def names(key)
28:       self[key].collect{|val| val =~ /NAME\s+'([\w\d_-]+)'/; $1}
29:     end

Return the superior object class of object class oc.

[Source]

    # File lib/ldap/schema.rb, line 64
64:     def sup(oc)
65:       attr(oc, "SUP")
66:     end

[Validate]