简体   繁体   中英

Is it possible to make a inetOrgPerson a member of a posixGroup in ldap php using active directory

Is it possible to make a inetOrgPerson a member of a posixgroup rather than added a manual entry inside of cn, im using php and ldap but i seem to come across this:

 Modify: Object class violation

code:

 $ldap = ldap_connect("localhost") or die("Unable to connect to server.");
 ldap_set_option($ldap,LDAP_OPT_PROTOCOL_VERSION,3);
 $dn = "cn=admin,dc=*******,dc=com";

 ldap_bind($ldap,$dn,"*****") or die("Unable to connect to server..");
 $dn = "cn=********,cn=*********,cn=*********,ou=A*******,dc=********,dc=com";

      $entry["cn"] = "MerPaul";
      $entry["objectClass"] = "inetOrgPerson";

      ldap_mod_add($ldap,$dn,$entry);

what am i doing wrong?

And objectClass in LDAP has optional and mandatory fields. inetOrgPerson is no exception.

The required fields of inetOrgPerson are sn and cn .

  $entry["cn"] = "MerPaul";
  $entry["sn"] = "Joe"
  $entry["objectClass"] = "inetOrgPerson";

  ldap_mod_add($ldap,$dn,$entry);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM