}
public static function tearDownAfterClass() {
- \OC_User::deleteUser(self::TEST_ENCRYPTION_MIGRATION_USER1);
- \OC_User::deleteUser(self::TEST_ENCRYPTION_MIGRATION_USER2);
- \OC_User::deleteUser(self::TEST_ENCRYPTION_MIGRATION_USER3);
+ $user = \OC::$server->getUserManager()->get(self::TEST_ENCRYPTION_MIGRATION_USER1);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get(self::TEST_ENCRYPTION_MIGRATION_USER2);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get(self::TEST_ENCRYPTION_MIGRATION_USER3);
+ if ($user !== null) { $user->delete(); }
parent::tearDownAfterClass();
}
protected function tearDown() {
\OC_User::setUserId('');
- \OC_User::deleteUser($this->user);
+ $user = \OC::$server->getUserManager()->get($this->user);
+ if ($user !== null) { $user->delete(); }
}
public function testUpdateFileTags() {
\OC_Util::tearDownFS();
\OC_User::setUserId('');
Filesystem::tearDown();
- \OC_User::deleteUser($this->user);
+ $user = \OC::$server->getUserManager()->get($this->user);
+ if ($user !== null) { $user->delete(); }
\OC_User::setIncognitoMode(false);
\OC::$server->getSession()->set('public_link_authenticated', '');
public static function tearDownAfterClass() {
// cleanup users
- \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER1);
- \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER2);
- \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER3);
+ $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER1);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER2);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3);
+ if ($user !== null) { $user->delete(); }
// delete group
\OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1);
protected function tearDown() {
\OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
$this->logout();
- \OC_User::deleteUser($this->user);
+ $user = \OC::$server->getUserManager()->get($this->user);
+ if ($user !== null) { $user->delete(); }
\OC_Hook::clear();
parent::tearDown();
}
public static function tearDownAfterClass() {
// cleanup test user
- \OC_User::deleteUser(self::TEST_TRASHBIN_USER1);
+ $user = \OC::$server->getUserManager()->get(self::TEST_TRASHBIN_USER1);
+ if ($user !== null) { $user->delete(); }
\OC::$server->getConfig()->setSystemValue('trashbin_retention_obligation', self::$rememberRetentionObligation);
public static function tearDownAfterClass() {
// cleanup test user
- \OC_User::deleteUser(self::TEST_VERSIONS_USER);
- \OC_User::deleteUser(self::TEST_VERSIONS_USER2);
+ $user = \OC::$server->getUserManager()->get(self::TEST_VERSIONS_USER);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get(self::TEST_VERSIONS_USER2);
+ if ($user !== null) { $user->delete(); }
parent::tearDownAfterClass();
}
}
}
- /**
- * delete a user
- *
- * @param string $uid The username of the user to delete
- * @return bool
- *
- * Deletes a user
- * @deprecated Use \OC::$server->getUserManager()->get() and then run delete() on the return
- */
- public static function deleteUser($uid) {
- $user = \OC::$server->getUserManager()->get($uid);
- if ($user) {
- return $user->delete();
- } else {
- return false;
- }
- }
-
/**
* Try to login a user
*
$tagManager->delete('tag2');
$this->logout();
- \OC_User::deleteUser($userId);
+ $user = \OC::$server->getUserManager()->get($userId);
+ if ($user !== null) { $user->delete(); }
}
function testMove() {
if ($this->cache) {
$this->cache->clear();
}
- $result = \OC_User::deleteUser(self::$user);
+
+ $result = false;
+ $user = \OC::$server->getUserManager()->get(self::$user);
+ if ($user !== null) { $result = $user->delete(); }
$this->assertTrue($result);
$this->logout();
$this->assertEquals('home::' . $userId, $homeMount->getId());
}
- \OC_User::deleteUser($userId);
+ $user = \OC::$server->getUserManager()->get($userId);
+ if ($user !== null) { $user->delete(); }
}
/**
$this->assertTrue($homeMount->instanceOfStorage('\OC\Files\Storage\Home'));
$this->assertEquals('local::' . $datadir . '/' . $userId . '/', $homeMount->getId());
- \OC_User::deleteUser($userId);
+ $user = \OC::$server->getUserManager()->get($userId);
+ if ($user !== null) { $user->delete(); }
// delete storage entry
$cache->clear();
}
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath('/' . $userId . '/cache');
$this->assertTrue($storage->instanceOfStorage('\OCP\Files\IHomeStorage'));
$this->assertEquals('cache', $internalPath);
- \OC_User::deleteUser($userId);
+ $user = \OC::$server->getUserManager()->get($userId);
+ if ($user !== null) { $user->delete(); }
$config->setSystemValue('cache_path', $oldCachePath);
}
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath('/' . $userId . '/cache');
$this->assertTrue($storage->instanceOfStorage('\OC\Files\Storage\Local'));
$this->assertEquals('', $internalPath);
- \OC_User::deleteUser($userId);
+ $user = \OC::$server->getUserManager()->get($userId);
+ if ($user !== null) { $user->delete(); }
$config->setSystemValue('cache_path', $oldCachePath);
}
// create users
$users = array('test');
foreach($users as $userName) {
- \OC_User::deleteUser($userName);
+ $user = \OC::$server->getUserManager()->get($userName);
+ if ($user !== null) { $user->delete(); }
\OC::$server->getUserManager()->createUser($userName, $userName);
}
$users = array('test');
foreach($users as $userName) {
- \OC_User::deleteUser($userName);
+ $user = \OC::$server->getUserManager()->get($userName);
+ if ($user !== null) { $user->delete(); }
}
parent::tearDown();
}
// clean up
\OC_User::setUserId('');
- \OC_User::deleteUser($user1);
+ $user = \OC::$server->getUserManager()->get($user1);
+ if ($user !== null) { $user->delete(); }
\OC::$server->getConfig()->deleteAllUserValues($user1);
\OC_Util::tearDownFS();
}
// clean up
\OC_User::setUserId('');
- \OC_User::deleteUser($user1);
+ $user = \OC::$server->getUserManager()->get($user1);
+ if ($user !== null) { $user->delete(); }
\OC::$server->getConfig()->deleteAllUserValues($user1);
\OC_Util::tearDownFS();
}
\OC\Files\Filesystem::mount($this->storage, array(), '/');
\OC_User::setUserId('');
- \OC_User::deleteUser($this->user);
+ $user = \OC::$server->getUserManager()->get($this->user);
+ if ($user !== null) { $user->delete(); }
\OC::$server->getConfig()->deleteAllUserValues($this->user);
parent::tearDown();
}
protected function tearDown() {
- \OC_User::deleteUser($this->username);
+ $user = \OC::$server->getUserManager()->get($this->username);
+ if ($user !== null) { $user->delete(); }
parent::tearDown();
}
$query->execute(array('test'));
\OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', $this->resharing);
- OC_User::deleteUser($this->user1);
- OC_User::deleteUser($this->user2);
- OC_User::deleteUser($this->user3);
- OC_User::deleteUser($this->user4);
- OC_User::deleteUser($this->user5);
- OC_User::deleteUser($this->user6);
- OC_User::deleteUser($this->groupAndUser);
+ $user = \OC::$server->getUserManager()->get($this->user1);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get($this->user2);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get($this->user3);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get($this->user4);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get($this->user5);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get($this->user6);
+ if ($user !== null) { $user->delete(); }
+ $user = \OC::$server->getUserManager()->get($this->groupAndUser);
+ if ($user !== null) { $user->delete(); }
OC_Group::deleteGroup($this->group1);
OC_Group::deleteGroup($this->group2);
// Remove user
OC_User::setUserId($this->user1);
- OC_User::deleteUser($this->user1);
+ $user = \OC::$server->getUserManager()->get($this->user1);
+ if ($user !== null) { $user->delete(); }
OC_User::setUserId($this->user2);
$this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
}
$uid = \OC_User::checkPassword('foo', 'bar');
$this->assertEquals($uid, 'foo');
}
-
- public function testDeleteUser() {
- $fail = \OC_User::deleteUser('victim');
- $this->assertFalse($fail);
-
- $success = \OC::$server->getUserManager()->createUser('victim', 'password');
-
- $success = \OC_User::deleteUser('victim');
- $this->assertTrue($success);
- }
}