![]() Communications Software |
||||||||||||
| Plexcel for PHP - Active Directory PHP Integration | ||||||||||||
| plexcel_new plexcel_status plexcel_find_authorities_by_domain plexcel_get_authority plexcel_get_domain plexcel_log plexcel_preamble plexcel_authenticate plexcel_sso plexcel_logon plexcel_logoff plexcel_accept_token plexcel_is_member_of plexcel_set_password plexcel_change_password plexcel_gen_service_keytab plexcel_search_objects plexcel_get_account plexcel_add_object plexcel_modify_object plexcel_delete_object plexcel_rename_object plexcel_set_attrdefs plexcel_get_attrdefs plexcel_set_conv_attrdefs |
Synopsisbool plexcel_modify_object(resource $px, array $obj, array $attrs) DescriptionThe plexcel_modify_object function can add, delete and replace attributes of an object in the directory. Multiple attribute modifications of different types can be performed with a single call. The $px parameter is the Plexcel context resource representing the directory binding and context specific options. The $obj parameter is an array of attribute names and values representing the attributes being added, replaced or deleted. All modifications are performed on the object identified by the distinguishedName attribute in the $obj parameter and therefore it must be present. The $attrs parameter is an array of attribute names and corresponding modification types. The modification types are described in the following table.
An $attrs element may also be only an attribute name with no modification type. In this case, the modification type will default to PLEXCEL_MOD_REPLACE . Meaning array('sn' => PLEXCEL_MOD_REPLACE) and array('sn') are equivalent. ReturnsThe plexcel_modify_object function returns TRUE if the directory successfully processed all modifications. Otherwise, FALSE is returned in which case the plexcel_status function should be consulted. ExampleThe following PHP fragment illustrates how to add a member to a group using plexcel_modify_object . $gacct = array('distinguishedName' => 'CN=Managers,OU=Europe,DC=example,DC=com',
'member' => array('CN=Hans Müller,CN=Users,DC=example,DC=com'));
$attrs = array('member' => PLEXCEL_MOD_ADD);
if (plexcel_modify_object($px, $gacct, $attrs) == FALSE) {
die('<pre>' . plexcel_status($px) . '</pre>');
}
Adding a user to a group with plexcel_modify_object
The following somewhat unrealistic PHP fragment demonstrates adding, replacing and deleting multiple attributes with one call to plexcel_modify_object . $acct = array('distinguishedName' => 'CN=fs1,OU=Linux Servers,DC=example,DC=com');
$acct['servicePrincipalName'] = array(
'host/fs1.example.com',
'FTP/fs1.example.com',
'cifs/fs1.example.com');
$acct['info'] = 'Storage for infrastructure and developers';
//
// add SPNs, replace info field and delete description field
//
$attrs = array('servicePrincipalName' => PLEXCEL_MOD_ADD,
'info' => PLEXCEL_MOD_REPLACE,
'description' => PLEXCEL_MOD_DELETE);
if (plexcel_modify_object($px, $acct, $attrs) == FALSE) {
$err = die('<pre>' . plexcel_status($px) . '</pre>');
}
Adding, replacing and deleting multiple attributes with one call to plexcel_modify_object
See alsoplexcel_add_object | plexcel_delete_object | plexcel_rename_object |
|||||||||||
|
© 2008 IOPLEX Software |
Contact Us |
Policies
|