/** * Rename a node in Alfresco, keeping all other data intact. * * @param string $uuid The node UUID value. * @param string $newname The new name value for the node. * @return bool True on success, False otherwise. */ function elis_files_node_rename($uuid, $newname) { $postdata = array( 'name' => $newname ); $response = elis_files_send('/moodle/noderename/' . $uuid, array('name' => $newname), 'POST'); $sxml = RLsimpleXMLelement($response); if (empty($sxml)) { return false; } return ($sxml->uuid == $uuid && $sxml->name == $newname); }
/** * Update a Moodle user's Alfresco account with a new password value. * * @param $CFG * @param object $user The Moodle DB record object or username. * @param string $password The new password for the Alfresco account. * @return bool True on success, False otherwise. */ function update_user_password($user, $password) { global $CFG; if (ELIS_FILES_DEBUG_TRACE) mtrace('update_user_password(' . $user->username . ', ' . $password . ')'); $username = elis_files_transform_username($user->username); // We need to create a new account now. $userdata = array( 'username' => $username, 'password' => $password, 'firstname' => $user->firstname, 'lastname' => $user->lastname, 'email' => $user->email, 'organization' => $user->institution ); if (!empty($this->config->user_quota)) { $userdata['quota'] = $this->config->user_quota; } $response = elis_files_send('/moodle/createuser', $userdata, 'POST'); try { $sxml = new SimpleXMLElement($response); } catch (Exception $e) { debugging(get_string('badxmlreturn', 'repository_elisfiles') . "\n\n$response", DEBUG_DEVELOPER); return false; } // Verify the correct return results. return (!empty($sxml->username) && !empty($sxml->firstname) && !empty($sxml->lastname) && !empty($sxml->email)); }