From b5db9b004c76401ce275242dca0eb1c3379155a8 Mon Sep 17 00:00:00 2001 From: Leigh B Stoller Date: Tue, 26 Dec 2017 13:08:32 -0700 Subject: [PATCH] Lets be a little smarter with users who are not members of any projects with sufficient permission to do anything useful (including geni users). Head them off at the pass and explain in simple (short), direct (short) clear (short) text why they can't do what they want to do. --- www/aptui/create-dataset.php | 5 ++++- www/aptui/geni-login.ajax | 4 +--- www/aptui/instantiate.php | 3 +++ www/aptui/manage_profile.php | 3 +++ www/aptui/quickvm_sup.php | 41 ++++++++++++++++++++++++++++++++++-- www/aptui/reserve.php | 3 +++ www/tbauth.php3 | 37 ++++++++++++++++++++++++++++++-- 7 files changed, 88 insertions(+), 8 deletions(-) diff --git a/www/aptui/create-dataset.php b/www/aptui/create-dataset.php index 70c13d928..8d5aa899b 100644 --- a/www/aptui/create-dataset.php +++ b/www/aptui/create-dataset.php @@ -1,6 +1,6 @@ uid_idx(); # diff --git a/www/aptui/geni-login.ajax b/www/aptui/geni-login.ajax index 40cbf69ca..b3f9516f5 100644 --- a/www/aptui/geni-login.ajax +++ b/www/aptui/geni-login.ajax @@ -392,9 +392,7 @@ function Do_VerifySpeaksfor() $blob["url"] = "showuser.php3"; } else { - $blob["url"] = ($this_user->webonly() || - !Instance::UserHasInstances($this_user) - ? "instantiate.php" : "landing.php"); + $blob["url"] = "landing.php"; } session_destroy(); SPITAJAX_RESPONSE($blob); diff --git a/www/aptui/instantiate.php b/www/aptui/instantiate.php index 259cb9b49..6d6a8fe64 100644 --- a/www/aptui/instantiate.php +++ b/www/aptui/instantiate.php @@ -43,6 +43,9 @@ RedirectSecure(); $this_user = CheckLogin($check_status); if (isset($this_user)) { CheckLoginOrDie(CHECKLOGIN_NONLOCAL|CHECKLOGIN_WEBONLY); + if (NOPROJECTMEMBERSHIP()) { + return NoProjectMembershipError($this_user); + } } else { RedirectLoginPage(); diff --git a/www/aptui/manage_profile.php b/www/aptui/manage_profile.php index 5e8386c58..b146bab66 100644 --- a/www/aptui/manage_profile.php +++ b/www/aptui/manage_profile.php @@ -40,6 +40,9 @@ $notifyclone = 0; RedirectSecure(); $this_user = CheckLoginOrRedirect(); $this_idx = $this_user->uid_idx(); +if ((!isset($action) || $action == "create") && NOPROJECTMEMBERSHIP()) { + return NoProjectMembershipError($this_user); +} # # Verify page arguments. diff --git a/www/aptui/quickvm_sup.php b/www/aptui/quickvm_sup.php index 478553fba..2cd7973c2 100644 --- a/www/aptui/quickvm_sup.php +++ b/www/aptui/quickvm_sup.php @@ -49,7 +49,7 @@ if (isset($_SERVER['SERVER_NAME'])) { # # Redefine this so APT errors are styled properly. Called by PAGEERROR();. # -$PAGEERROR_HANDLER = function($msg, $status_code = 0) { +$PAGEERROR_HANDLER = function($msg = null, $status_code = 0) { global $drewheader, $ISCLOUD, $ISPNET, $ISEMULAB, $ISAPT, $ISPOWDER; global $spatrequired, $TBMAINSITE, $PORTAL_HELPFORUM; @@ -57,7 +57,9 @@ $PAGEERROR_HANDLER = function($msg, $status_code = 0) { SPITHEADER(); } echo "
"; - echo $msg; + if ($msg) { + echo $msg; + } echo "