/** * Function called for changing user attributes * @param $FH FormHandler of the page * @param $mode add or edit mode */ function _glpi_changeUser($FH, $mode) { global $result; $username = $FH->getArrayOrPostValue("uid"); $password = $FH->getPostValue("pass"); // User entity rights $entities = $FH->getPostValue('entities'); $profiles = $FH->getPostValue('profiles'); $is_recursive = $FH->getPostValue('is_recursive'); $is_dynamic = $FH->getPostValue('is_dynamic'); // Building attr array $attrs = array(); foreach ($entities as $index => $entity) { $attrs[] = array('entity_id' => $entity, 'is_dynamic' => $is_dynamic[$index], 'is_recursive' => $is_recursive[$index], 'profile' => $profiles[$index]); } if ($password) { if ($mode == 'edit') { // Set only the new password setGlpiUserPassword($username, $password); } else { // Add a new user addGlpiUser($username, $password, $attrs); return 0; } } setLocationsForUser($username, $attrs); return 0; }
/** * function called for add or changed location for user */ function _inventory_changeUser($FH, $mode) { // global $result; $username = $FH->getArrayOrPostValue("uid"); $password = $FH->getPostValue("pass"); $entities = $FH->getPostValue('entitie'); setLocationsForUser($username, $entities); return 0; }