1Net::LDAP::Schema(3) User Contributed Perl Documentation Net::LDAP::Schema(3)
2
3
4
6 Net::LDAP::Schema - Load and manipulate an LDAP v3 Schema
7
9 use Net::LDAP;
10 use Net::LDAP::Schema;
11
12 #
13 # Read schema from server
14 #
15 $ldap = Net::LDAP->new ( $server );
16 $ldap->bind ( );
17 $schema = $ldap->schema ( );
18
19 #
20 # Load from LDIF
21 #
22 $schema = Net::LDAP::Schema->new;
23 $schema->parse ( "schema.ldif" ) or die $schema->error;
24
26 "Net::LDAP::Schema" provides a means to load an LDAP schema and query
27 it for information regarding supported objectclasses, attributes and
28 syntaxes.
29
31 Where a method is stated as taking the 'name or OID' of a schema item
32 (which may be an object class, attribute or syntax) then a case-
33 insensitive name or raw OID (object identifier, in dotted numeric
34 string form, e.g. 2.5.4.0) may be supplied.
35
36 Each returned item of schema (e.g. an attribute definition) is returned
37 in a HASH. The keys in the returned HASH are lowercase versions of the
38 keys read from the server. Here's a partial list (not all HASHes define
39 all keys) although note that RFC 4512 permits other keys as well:
40
41 name
42 desc
43 obsolete
44 sup
45 equality
46 ordering
47 substr
48 syntax
49 single-value
50 collective
51 no-user-modification
52 usage
53 abstract
54 structural
55 auxiliary
56 must
57 may
58 applies
59 aux
60 not
61 oc
62 form
63
64 all_attributes ( )
65 all_ditcontentrules ( )
66 all_ditstructurerules ( )
67 all_matchingrules ( )
68 all_matchingruleuses ( )
69 all_nameforms ( )
70 all_objectclasses ( )
71 all_syntaxes ( )
72 Returns a list of all the requested types in the schema.
73
74 attribute ( NAME )
75 ditcontentrule ( NAME )
76 ditstructurerule ( NAME )
77 matchingrule ( NAME )
78 matchingruleuse ( NAME )
79 nameform ( NAME )
80 objectclass ( NAME )
81 syntax ( NAME )
82 Returns a reference to a hash, or "undef" if the schema item does
83 not exist. "NAME" can be a name or an OID.
84
85 $attr_href = $schema->attribute( "attrname" );
86
87 dump ( )
88 Dump the raw schema information to standard out.
89
90 dump ( FILENAME )
91 Dump the raw schema information to a file.
92
93 $result = $schema->dump ( "./schema.dump" );
94
95 If no schema data is returned from directory server, the method
96 will return undefined. Otherwise a value of 1 is always returned.
97
98 error ( )
99 Returns the last error encountered when parsing the schema.
100
101 may ( OBJECTCLASS )
102 Given an argument which is the name or OID of a known object class,
103 returns a list of HASHes describing the attributes which are
104 optional in the class.
105
106 @may = $schema->may ( $oc );
107 # First optional attr has the name '$may[0]->{name}'
108
109 must ( OBJECTCLASS )
110 Given an argument which is the name or OID of a known object class,
111 returns a list of HASHes describing the attributes which are
112 mandatory in the class.
113
114 @must = $schema->must ( $oc );
115
116 parse ( MESG )
117 parse ( ENTRY )
118 parse ( FILENAME )
119 Takes a single argument which can be any of, a message object
120 returned from an LDAP search, a "Net::LDAP::Entry" object or the
121 name of a file containing an LDIF form of the schema.
122
123 If the argument is a message result from a search,
124 "Net::LDAP::Schema" will parse the schema from the first entry
125 returned.
126
127 Returns true on success and "undef" on error.
128
129 superclass ( NAME )
130 Given an argument which is the name or OID of a known objectclass,
131 returns the list of names of the immediate superclasses.
132
133 attribute_syntax ( NAME )
134 Given an attribute name, return the actual syntax taking into
135 account attribute supertypes.
136
137 matchingrule_for_attribute ( NAME, RULE )
138 Given an attribute name and a matching rule ("equality", "substr",
139 etc), return the actual rule taking into account attribute
140 supertypes.
141
143 Net::LDAP, Net::LDAP::RFC
144
146 Graham Barr <gbarr@pobox.com> John Berthels <jjb@nexor.co.uk>
147
148 Please report any bugs, or post any suggestions, to the perl-ldap
149 mailing list <perl-ldap@perl.org>.
150
152 Copyright (c) 1998-2004 Graham Barr. All rights reserved. This program
153 is free software; you can redistribute it and/or modify it under the
154 same terms as Perl itself.
155
156
157
158perl v5.34.0 2021-07-22 Net::LDAP::Schema(3)