-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[User Accounts] Hide UI option allowing users to edit their own appro…
…val status (#5353) Fix #4743 where a user could accidentally lock themselves out but editing their own approval status.
- Loading branch information
1 parent
966c242
commit efda4ff
Showing
2 changed files
with
112 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -68,6 +68,53 @@ class UserAccountsIntegrationTest extends LorisIntegrationTest | |
private $_table = "#dynamictable > tbody > tr:nth-child(1)"; | ||
private $_addUserBtn = "#default-panel > div > div > div.table-header >". | ||
" div > div > div:nth-child(2) > button:nth-child(1)"; | ||
|
||
/** | ||
* Does basic setting up of Loris variables for this test, such as | ||
* instantiting the config and database objects, creating a user | ||
* to user for the tests, and logging in. | ||
* | ||
* @return void | ||
*/ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$password = new \Password($this->validPassword); | ||
$this->DB->insert( | ||
"users", | ||
array( | ||
'ID' => 999995, | ||
'UserID' => 'UnitTesterTwo', | ||
'Real_name' => 'Unit Tester 2', | ||
'First_name' => 'Unit 2', | ||
'Last_name' => 'Tester 2', | ||
'Email' => '[email protected]', | ||
'Privilege' => 0, | ||
'PSCPI' => 'N', | ||
'Active' => 'Y', | ||
'Password_hash' => $password, | ||
'Password_expiry' => '2099-12-31', | ||
'Pending_approval' => 'N', | ||
) | ||
); | ||
|
||
$this->DB->insert( | ||
"user_psc_rel", | ||
array( | ||
'UserID' => 999995, | ||
'CenterID' => 1, | ||
) | ||
); | ||
|
||
$this->DB->insert( | ||
"user_project_rel", | ||
array( | ||
'UserID' => 999995, | ||
'ProjectID' => 1, | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Tests that, when loading the User accounts module > edit_user submodule, some | ||
* text appears in the body. | ||
|
@@ -119,7 +166,6 @@ function testUserAccountsMyPreferencesDoespageLoad() | |
function testUserAccountsFilterClearBtn() | ||
{ | ||
$this->safeGet($this->url . "/user_accounts/"); | ||
//testing data from RBdata.sql | ||
$this-> _testFilter($this->_name, $this->_table, null, "UnitTester"); | ||
$this-> _testFilter($this->_site, $this->_table, "1 rows", "3"); | ||
} | ||
|
@@ -202,7 +248,7 @@ function testUserAccountEdits() | |
// Test changing 'Active' status | ||
$this->_verifyUserModification( | ||
'user_accounts', | ||
'UnitTester', | ||
'UnitTesterTwo', | ||
'Active', | ||
'No' | ||
); | ||
|
@@ -216,10 +262,12 @@ function testUserAccountEdits() | |
// Test changing Approval status | ||
$this->_verifyUserModification( | ||
'user_accounts', | ||
'UnitTester', | ||
'UnitTesterTwo', | ||
'Pending_approval', | ||
'No' | ||
); | ||
//TODO:add test case to ensure pending_approval | ||
//DOES NOT show up on UnitTester since logged in user is UnitTester | ||
} | ||
/** | ||
* Tests various My Preference page edit operations. | ||
|
@@ -585,6 +633,9 @@ function _accessUser($page, $userId) | |
function tearDown() | ||
{ | ||
$this->DB->delete("users", array("UserID" => 'userid')); | ||
$this->DB->delete("user_psc_rel", array("UserID" => 999995)); | ||
$this->DB->delete("user_project_rel", array("UserID" => 999995)); | ||
$this->DB->delete("users", array("UserID" => 'UnitTesterTwo')); | ||
parent::tearDown(); | ||
} | ||
} | ||
|