Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

142 lines (88 sloc) 3.675 kb

NAME

Net::LDAP::Schema - Load and manipulate an LDAP v3 Schema

SYNOPSIS

 use Net::LDAP;
 use Net::LDAP::Schema;

 #
 # Read schema from server
 #
 $ldap = Net::LDAP->new( $server );
 $ldap->bind();
 $schema = $ldap->schema();

 #
 # Load from LDIF
 #
 $schema = Net::LDAP->new( "schema.ldif" );

DESCRIPTION

Net::LDAP::Schema provides a means to load an LDAP schema and query it for information regarding supported objectclasses, attributes and syntaxes.

METHODS

Where a method is stated as taking the 'name or oid' of a schema item (which may be an object class, attribute or syntax) then a case-insensitive name or raw oid (object identifier, in dotted numeric string form, e.g. 2.5.4.0) may be supplied.

attributes

With no arguments, returns a list of the names all attributes in the schema.

  @atts = $schema->attributes();

If called with an argument which is the name or oid of a known object class, returns a list of the attributes which may (or must) be present in the OC.

  @person_atts = $schema->attributes( "person" );

Return value is an array or array reference depending on calling context, or empty list on error.

objectclasses

Returns a list of the names of all objectclasses in the schema.

  @ocs = $schema->objectclasses();

Return value is an array or array reference depending on calling context.

superclass

Given an argument which is the name or oid of a known objectclass, returns the list of names of the immediate superclasses.

syntaxes

Returns a list of the names of all objectclasses in the schema. (The name of a syntax is not well defined. It may be an OID or abbreviated description).

  @syns = $schema->syntaxes();

Return value is an array or array reference depending on calling context.

syntax

Given an argument which is the name or oid of a known attribute, returns the name of the attribute's syntax (or the syntax of the attributes superior if the syntax is inherited).

  $name_syntax = $schema->syntax( "commonName" );
must

Given an argument which is the name or oid of a known object class, returns the name of the attributes which are mandatory in the class

  @must = $schema->must( $oc );

Return value is an array or array reference depending on calling context.

may

Given an argument which is the name or oid of a known object class, returns the name of the attributes which are optional in the class.

  @may = $schema->may( $oc );

Return value is an array or array reference depending on calling context.

name2oid

Given the name of a schema item (object class, attribute or syntax) returns the assoicated OID or undef if it is not recognised.

is_objectclass, is_attribute, is_syntax

Given the name or oid of a schema item (object class, attribute or syntax respectively) returns the assoicated OID or undef if the name or oid is not of the appropriate type.

  # Is foo a known OC?
  $oid = $schema->is_objectclass( "foo" );
  # No? Bale out.
  die( "Not an objectclass" ) unless $oid;
  # Yes...so we can do this
  @must = $schema->must( $oid );

SEE ALSO

Net::LDAP, Other online documentation

AUTHORS

Graham Barr <gbarr@pobox.com> John Berthels <jjb@nexor.co.uk>

Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap-dev@lists.sourceforge.net>.

COPYRIGHT

Copyright (c) 1998-2000 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


$Id: Schema.pod,v 1.3 2000/05/09 16:09:49 gbarr Exp $

Jump to Line
Something went wrong with that request. Please try again.