public function loginSubmit() { if (Utilities::form_submitted()) { $username = $_POST['username']; $password = $_POST['password']; try { if (WSIS::authenticate($username, $password)) { if (in_array(Config::get('pga_config.wsis')['admin-role-name'], (array) WSIS::getUserRoles($username))) { Session::put("admin", true); } Utilities::store_id_in_session($username); Utilities::print_success_message('Login successful! You will be redirected to your home page shortly.'); Session::put("gateway_id", Config::get('pga_config.wsis')['gateway-id']); //TODO::If this option is not safe, have to find a better method to send credentials to identity server on every connection. Session::put("password", $_POST["password"]); return Redirect::to("home"); } else { return Redirect::to("login")->with("invalid-credentials", true); } } catch (Exception $ex) { return Redirect::to("login")->with("invalid-credentials", true); } } }
/** * Cancel the experiment with the given ID * @param $expId */ public static function cancel_experiment($expId) { try { Airavata::terminateExperiment($expId); Utilities::print_success_message("Experiment canceled!"); } catch (InvalidRequestException $ire) { Utilities::print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>'); } catch (ExperimentNotFoundException $enf) { Utilities::print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>'); } catch (AiravataClientException $ace) { Utilities::print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>AiravataClientException: ' . $ace->getMessage() . '</p>'); } catch (AiravataSystemException $ase) { Utilities::print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>'); } catch (TTransportException $tte) { Utilities::print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>TTransportException: ' . $tte->getMessage() . '</p>'); } catch (Exception $e) { Utilities::print_error_message('<p>There was a problem canceling the experiment. Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>Exception: ' . $e->getMessage() . '</p>'); } }
public static function create_project() { $project = new Project(); $project->owner = Session::get('username'); $project->name = $_POST['project-name']; $project->description = $_POST['project-description']; $projectId = null; try { $projectId = Airavata::createProject( Session::get("gateway_id"), $project); if ($projectId) { Utilities::print_success_message("<p>Project {$_POST['project-name']} created!</p>" . '<p>You will be redirected to the summary page shortly, or you can <a href="project/summary?projId=' . $projectId . '">go directly</a> to the project summary page.</p>'); } else { Utilities::print_error_message("Error creating project {$_POST['project-name']}!"); } } catch (InvalidRequestException $ire) { Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage()); } catch (AiravataClientException $ace) { Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage()); } catch (AiravataSystemException $ase) { Utilities::print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage()); } return $projectId; }