Retrieve and process information pertaining to LDAP schemas.
# File lib/ldap/schema.rb, line 16 def initialize(entry) if( entry ) entry.each do |key, vals| self[key] = vals end end 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 def attr(oc,at) self['objectClasses'].each do |s| if( s =~ /NAME\s+'#{oc}'/ ) case s when /#{at}\s+\(([\w\d_\-\s\$]+)\)/ then return $1.split("$").collect{|attr| attr.strip} when /#{at}\s+([\w\d_\-]+)/ then return $1.split("$").collect{|attr| attr.strip} end end end return nil end
Return the list of attributes that an entry with object class
oc
may possess.
# File lib/ldap/schema.rb, line 57 def may(oc) attr(oc, "MAY") end
Return the list of attributes that an entry with object class
oc
must possess.
# File lib/ldap/schema.rb, line 50 def must(oc) attr(oc, "MUST") 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 def names(key) self[key].collect{|val| val =~ /NAME\s+'([\w\d_\-]+)'/; $1} end
Return the superior object class of object class oc
.
# File lib/ldap/schema.rb, line 63 def sup(oc) attr(oc, "SUP") end