/** * Controller for a retrieve account request. * @global array $_POST only set if the browser has POSTed data * @return null */ function retrieve() { //Check the portal is not in read only mode, returns exception if it is checkPortalIsNotReadOnly(); if ($_POST) { // If we receive a POST request it's to update a user submit(); } else { // If there is no post data, draw the edit user form draw(); } }
/** * Controller for a delete user request * @return null */ function delete() { require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php'; require_once __DIR__ . '/../../../../htdocs/web_portal/components/Get_User_Principle.php'; require_once __DIR__ . '/utils.php'; //Check the portal is not in read only mode, returns exception if it is checkPortalIsNotReadOnly(); if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) { throw new Exception("An id must be specified"); } $serv = \Factory::getUserService(); $user = $serv->getUser($_REQUEST['id']); $dn = Get_User_Principle(); $currentUser = $serv->getUserByPrinciple($dn); try { $serv->deleteUser($user, $currentUser); } catch (\Exception $e) { show_view('error.php', $e->getMessage()); die; } show_view('user/deleted_user.php'); }
/** * Controller for user to confirm their DN change * @return null */ function validate_dn_change() { require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php'; require_once __DIR__ . '/../../../../htdocs/web_portal/components/Get_User_Principle.php'; require_once __DIR__ . '/utils.php'; //Check the portal is not in read only mode, returns exception if it is checkPortalIsNotReadOnly(); if (!isset($_REQUEST['c'])) { show_view('error.php', "a confirmation code must be specified"); } $confirmationCode = $_REQUEST['c']; $currentDn = Get_User_Principle(); if (empty($currentDn)) { show_view('error.php', "Could not authenticate user - null user principle"); die; } try { Factory::getRetrieveAccountService()->confirmAccountRetrieval($confirmationCode, $currentDn); } catch (\Exception $e) { show_view('error.php', $e->getMessage()); die; } show_view('user/retrieved_account.php'); }