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 then return $1.split("$").collect{|attr| attr.strip}
39:           when /#{at}\s+([\w\d_\-]+)/i then return $1.split("$").collect{|attr| attr.strip}
40:           end
41:         end
42:       }
43:       return nil
44:     end

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

[Source]

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

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

[Source]

    # File lib/ldap/schema.rb, line 49
49:     def must(oc)
50:       attr(oc, "MUST")
51:     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 62
62:     def sup(oc)
63:       attr(oc, "SUP")
64:     end

[Validate]