Delete a user and all its access, given its login.
public deleteUser ( string $userLogin ) : boolean | ||
$userLogin | string | the user login. |
Résultat | boolean | true on success |
/** * normal case, user deleted */ public function testDeleteUser() { $this->addSites(3); //add user and set some rights $this->api->addUser("geggeqgeqag", "geqgeagae", "*****@*****.**", "alias"); $this->api->setUserAccess("geggeqgeqag", "view", array(1, 2)); $this->api->setUserAccess("geggeqgeqag", "admin", array(1, 3)); // check rights are set $this->assertNotEquals(array(), $this->api->getSitesAccessFromUser("geggeqgeqag")); // delete the user $this->api->deleteUser("geggeqgeqag"); // try to get it, it should raise an exception try { $this->api->getUser("geggeqgeqag"); $this->fail("Exception not raised."); } catch (Exception $expected) { $this->assertRegExp("(UsersManager_ExceptionUserDoesNotExist)", $expected->getMessage()); } // add the same user $this->api->addUser("geggeqgeqag", "geqgeagae", "*****@*****.**", "alias"); //checks access have been deleted //to do so we recreate the same user login and check if the rights are still there $this->assertEquals(array(), $this->api->getSitesAccessFromUser("geggeqgeqag")); }