isReadOnly() ) pla_error( _('You cannot perform updates while server is in read-only mode') ); if( ! $ldapserver->haveAuthInfo()) pla_error( _('Not enough information to login to server. Please check your configuration.') ); if (! isset($_REQUEST['new_oclass'])) pla_error( _('You did not select any ObjectClasses for this object. Please go back and do so.')); $new_oclass = $_REQUEST['new_oclass']; $dn = rawurldecode( $_REQUEST['dn'] ); $encoded_dn = rawurlencode( $dn ); /* 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 = $ldapserver->getDNAttrs($dn,true); $current_attrs = array(); foreach( $entry as $attr => $junk ) $current_attrs[] = strtolower($attr); // grab the required attributes for the new objectClass $schema_oclasses = $ldapserver->SchemaObjectClasses(); $must_attrs = array(); foreach( $new_oclass as $oclass_name ) { $oclass = $ldapserver->getSchemaObjectClass($oclass_name); if( $oclass ) $must_attrs = array_merge( $must_attrs, $oclass->getMustAttrNames( $schema_oclasses ) ); } $must_attrs = array_unique( $must_attrs ); // We don't want any of the attr meta-data, just the string //foreach( $must_attrs as $i => $attr ) //$must_attrs[$i] = $attr->getName(); // 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 ) { $attr = $ldapserver->getSchemaAttribute($attr); //echo "
"; var_dump( $attr ); echo ""; // First, check if one of this attr's aliases is already an attribute of this entry foreach( $attr->getAliases() as $alias_attr_name ) if( in_array( strtolower( $alias_attr_name ), $current_attrs ) ) // Skip this attribute since it's already in the entry continue; if( in_array( strtolower($attr->getName()), $current_attrs ) ) continue; // We made it this far, so the attribute needs to be added to this entry in order // to add this objectClass $needed_attrs[] = $attr; } if( count( $needed_attrs ) > 0 ) { include './header.php'; ?>