note 74581 added to function.ldap-modify

From: Date: Wed, 18 Apr 2007 13:09:54 +0000
Subject: note 74581 added to function.ldap-modify
Groups: php.notes 
Request: Send a blank email to php-notes+get-125545@lists.php.net to get a copy of this message
Following goetz at rvs dot uni-hannover dot de's comment, it is not exactly true that ldap_modify can't change objectclass. In fact, it's impossible to add an objectclass which is set as STRUCTURAL in the schema description. But you can add an objectclass set as AUXILIARY. See OpenLDAP FAQ below for explanation why : http://www.openldap.org/faq/data/cache/1341.html For example, if you have an ldap entry of type "device", which is a structural objectclass, named "cn=myNetCard,ou=Networks,dc=example,dc=com", you can do this : <?php $entry["objectclass"][0] = "device"; $entry["objectclass"][1] = "ieee802Device"; // add an auxiliary objectclass $entry["macAddress"][0] = "aa:bb:cc:dd:ee:ff"; ldap_modify ($cnx, "cn=myNetCard,ou=Networks,dc=example,dc=com", $entry); ?> But this will not work : <?php $entry["objectclass"][0] = "device"; $entry["objectclass"][1] = "ipNetwork"; // add a structural objectclass $entry["ipNetworkNumber"][0] = "1.2.3.4"; ldap_modify ($cnx, "cn=myNetCard,ou=Networks,dc=example,dc=com", $entry); ?> You will get the following error : "Cannot modify object class" ---- Server IP: 194.246.101.61 Probable Submitter: 193.48.220.14 (proxied: 193.48.220.185) ---- Manual Page -- http://www.php.net/manual/en/function.ldap-modify.php Edit -- https://master.php.net/note/edit/74581 Del: integrated -- https://master.php.net/note/delete/74581/integrated Del: useless -- https://master.php.net/note/delete/74581/useless Del: bad code -- https://master.php.net/note/delete/74581/bad+code Del: spam -- https://master.php.net/note/delete/74581/spam Del: non-english -- https://master.php.net/note/delete/74581/non-english Del: in docs -- https://master.php.net/note/delete/74581/in+docs Del: other reasons-- https://master.php.net/note/delete/74581 Reject -- https://master.php.net/note/reject/74581 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125545) next »