Blame | Letzte Änderung | Log anzeigen | RSS feed
Examples:First of all connect to your server as usual. (Some servers requireauthentication to get the Subschema entry)$config = array( 'host' => 'localhost' );$ldap = Net_LDAP2::connect( $config );if( Net_LDAP2::isError( $ldap ) ) die ( $ldap->getMessage() )Then we can get the schema.$schema = $ldap->schema();if( Net_LDAP2::isError( $schema ) ) die ( $schema->getMessage() );You can give a parameter to $ldap->schema() which sets the Subschema Entry dn.If it is omitted, the entry dn will be fetched internally via rootDSE().If that fails it will be set to "cn=Subschema".$schema = $ldap->schema( 'cn=Subschema' );Now you can work with the schema and retrieve information:$attrs = $schema->getAll( 'attributes' );This returns an array with all attributes and their information such as syntax,equality, max_length etc. Look at the returned array to see what information waspassed.Valid options to getAll() are:objectclassesattributesditcontentrulesditstructurerulesmatchingrulesmatchingruleusesnameformssyntaxesIf you know the the name of an attribute or objectclass you can get theinformation directly.$attr = $schema->get('attribute', 'userPassword');$oc = $schema->get('objectclass', 'posixAccount');The first parameter determines the type of entry to be fetched and can be oneof:attributeditcontentruleditstructurerulematchingrulematchingruleusenameformobjectclasssyntaxThe second parameter can be the name or the oid of the entry.You can retrieve a list of required and optional attributes of an object classvia must( $oc ) or may( $oc ). Both return a list of attributes in an array.$required = $schema->must( 'posixAccount' );$optional = $schema->may( 'posixAccount' );