function alfresco_user_request() { global $USER; $username = alfresco_transform_username($USER->username); $result = alfresco_utils_invoke_service('/api/people/' . $username); return $result; }
/** * 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 (ALFRESCO_DEBUG_TRACE) { mtrace('update_user_password(' . $user->username . ', ' . $password . ')'); } $username = alfresco_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($CFG->repository_alfresco_user_quota)) { $userdata['quota'] = $CFG->repository_alfresco_user_quota; } $response = alfresco_send('/moodle/createuser', $userdata, 'POST'); try { $sxml = new SimpleXMLElement($response); } catch (Exception $e) { debugging(get_string('badxmlreturn', 'repository_alfresco') . "\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); }