getByUserName( $user_name ); if ( $ulf->getRecordCount() == 1 ) { $u_obj = $ulf->getCurrent(); echo "Found user " . $u_obj->getFullName() . ", attempting to delete identification information...\n"; ob_flush(); $uilf = new UserIdentificationListFactory(); $uilf->StartTransaction(); if ( strtolower( $data['t'] ) == 'all' ) { $uilf->getByUserId( $u_obj->getID() ); } else { $uilf->getByUserIdAndTypeId( $u_obj->getID(), (int)$data['t'] ); } if ( $uilf->getRecordCount() > 0 ) { foreach ( $uilf as $ui_obj ) { if ( $ui_obj->getType() != 5 ) { //Skip password history records. $ui_obj->setDeleted( true ); if ( $ui_obj->isValid() ) { echo " Deleting Identification Record (" . $ui_obj->getID() . ") of type '" . Option::getByKey( $ui_obj->getType(), $ui_obj->getOptions( 'type' ) ) . "' (" . $ui_obj->getType() . ") from " . $u_obj->getFullName() . "\n"; $ui_obj->Save(); } } } } else { echo "ERROR: No identification records to delete!\n"; } if ( $data['dryrun'] == true ) { echo "NOTICE: Dry-run enabled, not committing changed to database!\n"; $uilf->FailTransaction(); } $uilf->CommitTransaction(); } else if ( $ulf->getRecordCount() > 2 ) { echo "Found more then one user with the same user name, not deleting any data!\n"; } else { echo "User name not found!\n"; } } } echo "WARNING: You may need to wait for devices to synchronize before changes take effect...\n"; //Debug::Display(); Debug::writeToLog(); ?>