| Class | LDAP::Schema |
| In: |
lib/ldap/schema.rb
|
| Parent: | Hash |
# 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
Return the list of attributes in object class oc that are of category at. at may be the string MUST, MAY or SUP.
# 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.
# 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.
# 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.
# File lib/ldap/schema.rb, line 27
27: def names(key)
28: self[key].collect{|val| val =~ /NAME\s+'([\w\d]+)'/; $1}
29: end