class Bundler::URI::LDAP
++
]]]
–
LDAP Bundler::URI SCHEMA (described in RFC2255).
def self.build(args)
"/dc=example;dc=com", "query", nil, nil, nil])
uri = Bundler::URI::LDAP.build(["ldap.example.com", nil,
:dn => '/dc=example'})
uri = Bundler::URI::LDAP.build({:host => 'ldap.example.com',
Example:
order
[host, port, dn, attributes, scope, filter, extensions]
.If an Array is used, the components must be passed in the
with keys formed by preceding the component names with a colon.
The components should be provided either as an Array, or as a Hash
scope, filter, and extensions.
The components accepted are host, port, dn, attributes,
Creates a new Bundler::URI::LDAP object from components, with syntax checking.
== Description
def self.build(args) tmp = Util::make_components_hash(self, args) if tmp[:dn] tmp[:path] = tmp[:dn] end query = [] [:extensions, :filter, :scope, :attributes].collect do |x| next if !tmp[x] && query.size == 0 query.unshift(tmp[x]) end tmp[:query] = query.join('?') return super(tmp) end
def attributes
def attributes @attributes end
def attributes=(val)
def attributes=(val) set_attributes(val) val end
def build_path_query
def build_path_query @path = '/' + @dn query = [] [@extensions, @filter, @scope, @attributes].each do |x| next if !x && query.size == 0 query.unshift(x) end @query = query.join('?') end
def dn
def dn @dn end
def dn=(val)
def dn=(val) set_dn(val) val end
def extensions
def extensions @extensions end
def extensions=(val)
def extensions=(val) set_extensions(val) val end
def filter
def filter @filter end
def filter=(val)
def filter=(val) set_filter(val) val end
def hierarchical?
Checks if Bundler::URI has a path.
def hierarchical? false end
def initialize(*arg)
See also Bundler::URI::Generic.new.
"/dc=example;dc=com", nil, "query", nil)
uri = Bundler::URI::LDAP.new("ldap", nil, "ldap.example.com", nil, nil,
Example:
+opaque+, +query+, and +fragment+, in that order.
Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
RFC 2396. No LDAP-specific syntax checking is performed.
Creates a new Bundler::URI::LDAP object from generic Bundler::URI components as per
== Description
def initialize(*arg) super(*arg) if @fragment raise InvalidURIError, 'bad LDAP URL' end parse_dn parse_query end
def parse_dn
def parse_dn raise InvalidURIError, 'bad LDAP URL' unless @path @dn = @path[1..-1] end
def parse_query
Private method to cleanup +attributes+, +scope+, +filter+, and +extensions+
def parse_query @attributes = nil @scope = nil @filter = nil @extensions = nil if @query attrs, scope, filter, extensions = @query.split('?') @attributes = attrs if attrs && attrs.size > 0 @scope = scope if scope && scope.size > 0 @filter = filter if filter && filter.size > 0 @extensions = extensions if extensions && extensions.size > 0 end end
def scope
def scope @scope end
def scope=(val)
def scope=(val) set_scope(val) val end
def set_attributes(val)
def set_attributes(val) @attributes = val build_path_query @attributes end
def set_dn(val)
def set_dn(val) @dn = val build_path_query @dn end
def set_extensions(val)
def set_extensions(val) @extensions = val build_path_query @extensions end
def set_filter(val)
def set_filter(val) @filter = val build_path_query @filter end
def set_scope(val)
def set_scope(val) @scope = val build_path_query @scope end