-
Notifications
You must be signed in to change notification settings - Fork 11
Add ability to cancel request, require confirmation of account policy, fix dubious redirect #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8699854
Allow new user to cancel requests
bryank-cs b7ad6c2
Add test case for cancellation
bryank-cs a680fdd
Beutify code
bryank-cs 312c7cc
squash deprecation warning
simonLeary42 bb1097d
Update key to current value
bryank-cs daab92b
Fix spelling
bryank-cs 03ef3f2
Fix wording
bryank-cs 6c6351f
Allow no data for http_get mock
bryank-cs b362aae
Remove duplicate functionality; clean up calls
bryank-cs 5b6773d
Add new config option for account policy
bryank-cs b85fc07
Some fixups
bryank-cs cff553e
Redirect must use self::die for phpunit
bryank-cs 0cd8393
Use existing interface better
bryank-cs 79a075a
phpcs fix
bryank-cs 5c84a6a
Cancel2 (#225)
simonLeary42 f7e1dc3
Cancel2 (#226)
simonLeary42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
// This template is sent to the user cancelling the request | ||
$this->Subject = "Unity Account Request Cancelled"; | ||
?> | ||
|
||
<p>Hello,</p> | ||
|
||
<p>Your request to join group '<?php echo $data["group"]; ?>' on the Unity Cluster has been cancelled per your request. | ||
</p> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
// This template is sent to the user cancelling the request | ||
$this->Subject = "Unity PI Account Request Cancelled"; | ||
?> | ||
|
||
<p>Hello,</p> | ||
|
||
<p>Your request for a PI account on the Unity Cluster has been cancelled per your request.</p> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use UnityWebPortal\lib\exceptions\PhpUnitNoDieException; | ||
|
||
class CancelRequestTest extends TestCase | ||
{ | ||
private function assertNumberGroupRequests(int $x) | ||
{ | ||
global $USER, $SQL; | ||
$this->assertEquals($x, count($SQL->getRequestsByUser($USER->getUID()))); | ||
} | ||
|
||
public function testCancelPIRequest() | ||
{ | ||
global $USER, $SQL; | ||
switchUser(...getNonExistentUser()); | ||
// First create a request | ||
try { | ||
http_post( | ||
__DIR__ . "/../../webroot/panel/new_account.php", | ||
["new_user_sel" => "pi", "eula" => "agree", "confirm_pi" => "agree"] | ||
); | ||
} catch (PhpUnitNoDieException $e) { | ||
// Ignore the exception from http_post | ||
} | ||
|
||
$this->assertNumberGroupRequests(1); | ||
|
||
// Now try to cancel it | ||
try { | ||
http_post( | ||
__DIR__ . "/../../webroot/panel/new_account.php", | ||
["cancel" => "true"] # value of cancel is arbitrary | ||
); | ||
} catch (PhpUnitNoDieException $e) { | ||
// Ignore the exception from http_post | ||
} | ||
|
||
$this->assertNumberGroupRequests(0); | ||
} | ||
|
||
public function testCancelGroupJoinRequest() | ||
{ | ||
global $USER, $SQL; | ||
switchUser(...getNonExistentUser()); | ||
|
||
try { | ||
http_post( | ||
__DIR__ . "/../../webroot/panel/new_account.php", | ||
["new_user_sel" => "not_pi", "eula" => "agree", "pi" => getExistingPI()] | ||
); | ||
} catch (PhpUnitNoDieException $e) { | ||
// Ignore the exception from http_post | ||
} | ||
|
||
$this->assertNumberGroupRequests(1); | ||
|
||
// Now try to cancel it | ||
try { | ||
http_post( | ||
__DIR__ . "/../../webroot/panel/new_account.php", | ||
["cancel" => "true"] # value of cancel is arbitrary | ||
); | ||
} catch (PhpUnitNoDieException $e) { | ||
// Ignore the exception from http_post | ||
} | ||
|
||
$this->assertNumberGroupRequests(0); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.