Example #1
0
pla_ldap_connect($server_id) or pla_error("Coult not connect to LDAP server.");
$friendly_attrs = process_friendly_attr_table();
$attrs = get_object_attrs($server_id, $dn);
pla_ldap_connect($server_id) or pla_error("Could not connect to LDAP server");
$system_attrs = get_entry_system_attrs($server_id, $dn);
if (!$attrs) {
    pla_error("No such dn, " . htmlspecialchars(utf8_decode($dn)));
}
$server_name = $servers[$server_id]['name'];
// build a list of attributes available for this object based on its objectClasses
$oclasses = get_object_attr($server_id, $dn, 'objectClass');
if (!is_array($oclasses)) {
    $oclasses = array($oclasses);
}
$avail_attrs = array();
$schema_oclasses = get_schema_objectclasses($server_id, true);
$schema_attrs = get_schema_attributes($server_id);
foreach ($oclasses as $oclass) {
    $avail_attrs = array_merge($schema_oclasses[strtolower($oclass)]['must_attrs'], $schema_oclasses[strtolower($oclass)]['may_attrs'], $avail_attrs);
}
$avail_attrs = array_unique($avail_attrs);
$avail_attrs = array_filter($avail_attrs, "not_an_attr");
sort($avail_attrs);
$avail_binary_attrs = array();
foreach ($avail_attrs as $i => $attr) {
    if (is_attr_binary($server_id, $attr)) {
        $avail_binary_attrs[] = $attr;
        unset($avail_attrs[$i]);
    }
}
?>
$server_id = $_POST['server_id'];
if (is_server_read_only($server_id)) {
    pla_error($lang['no_updates_in_read_only_mode']);
}
check_server_id($server_id) or pla_error($lang['bad_server_id']);
have_auth_info($server_id) or pla_error($lang['not_enough_login_info']);
/* Ensure that the object has defined all MUST attrs for this objectClass.
 * If it hasn't, present a form to have the user enter values for all the
 * newly required attrs. */
$entry = get_object_attrs($server_id, $dn, true);
$current_attrs = array();
foreach ($entry as $attr => $junk) {
    $current_attrs[] = strtolower($attr);
}
// grab the required attributes for the new objectClass
$must_attrs = get_schema_objectclasses($server_id);
$must_attrs = $must_attrs[strtolower($new_oclass)]['must_attrs'];
sort($must_attrs);
// build a list of the attributes that this new objectClass requires,
// but that the object does not currently contain
$needed_attrs = array();
foreach ($must_attrs as $attr) {
    if (!in_array(strtolower($attr), $current_attrs)) {
        $needed_attrs[] = $attr;
    }
}
if (count($needed_attrs) > 0) {
    include 'header.php';
    ?>
	<body>