aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2015-12-17 15:59:23 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2015-12-17 16:18:40 +0100
commit1f715289bf1cafb7e51dce7a4ab478dd3db5088e (patch)
tree81d3623bff851e08b205cfc3bbefc5c886ef530e
parent9201b9713ed21566f90628d41c49056ca5314096 (diff)
downloadnextcloud-server-1f715289bf1cafb7e51dce7a4ab478dd3db5088e.tar.gz
nextcloud-server-1f715289bf1cafb7e51dce7a4ab478dd3db5088e.zip
Removed deprecated function OC_User::deleteUser
Replaced with proper OCP calls
-rw-r--r--apps/encryption/tests/lib/MigrationTest.php9
-rw-r--r--apps/files/tests/service/tagservice.php3
-rw-r--r--apps/files_sharing/tests/controller/sharecontroller.php3
-rw-r--r--apps/files_sharing/tests/testcase.php9
-rw-r--r--apps/files_trashbin/tests/storage.php3
-rw-r--r--apps/files_trashbin/tests/trashbin.php3
-rw-r--r--apps/files_versions/tests/versions.php6
-rw-r--r--lib/private/user.php18
-rw-r--r--tests/lib/files/cache/cache.php3
-rw-r--r--tests/lib/files/cache/updaterlegacy.php5
-rw-r--r--tests/lib/files/filesystem.php12
-rw-r--r--tests/lib/files/objectstore/swift.php6
-rw-r--r--tests/lib/files/storage/homestoragequota.php6
-rw-r--r--tests/lib/helperstorage.php3
-rw-r--r--tests/lib/security/certificatemanager.php3
-rw-r--r--tests/lib/share/share.php24
-rw-r--r--tests/lib/user.php10
17 files changed, 66 insertions, 60 deletions
diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/lib/MigrationTest.php
index ec1dccb87b8..6df72ac1bf6 100644
--- a/apps/encryption/tests/lib/MigrationTest.php
+++ b/apps/encryption/tests/lib/MigrationTest.php
@@ -49,9 +49,12 @@ class MigrationTest extends \Test\TestCase {
}
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();
}
diff --git a/apps/files/tests/service/tagservice.php b/apps/files/tests/service/tagservice.php
index a34bd05afcc..b93dedd0efd 100644
--- a/apps/files/tests/service/tagservice.php
+++ b/apps/files/tests/service/tagservice.php
@@ -82,7 +82,8 @@ class TagServiceTest extends \Test\TestCase {
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() {
diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php
index d165151b87f..398538f0943 100644
--- a/apps/files_sharing/tests/controller/sharecontroller.php
+++ b/apps/files_sharing/tests/controller/sharecontroller.php
@@ -98,7 +98,8 @@ class ShareControllerTest extends \Test\TestCase {
\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', '');
diff --git a/apps/files_sharing/tests/testcase.php b/apps/files_sharing/tests/testcase.php
index cc82fc3d949..c4037c7c42e 100644
--- a/apps/files_sharing/tests/testcase.php
+++ b/apps/files_sharing/tests/testcase.php
@@ -117,9 +117,12 @@ abstract class TestCase extends \Test\TestCase {
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);
diff --git a/apps/files_trashbin/tests/storage.php b/apps/files_trashbin/tests/storage.php
index 387bb20c6d4..30735fe7bc3 100644
--- a/apps/files_trashbin/tests/storage.php
+++ b/apps/files_trashbin/tests/storage.php
@@ -75,7 +75,8 @@ class Storage extends \Test\TestCase {
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();
}
diff --git a/apps/files_trashbin/tests/trashbin.php b/apps/files_trashbin/tests/trashbin.php
index e8d586816c3..9c19b67a904 100644
--- a/apps/files_trashbin/tests/trashbin.php
+++ b/apps/files_trashbin/tests/trashbin.php
@@ -88,7 +88,8 @@ class Test_Trashbin extends \Test\TestCase {
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);
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php
index ffc98c2e98c..ee4978ff784 100644
--- a/apps/files_versions/tests/versions.php
+++ b/apps/files_versions/tests/versions.php
@@ -61,8 +61,10 @@ class Test_Files_Versioning extends \Test\TestCase {
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();
}
diff --git a/lib/private/user.php b/lib/private/user.php
index e84da5cf843..f806aa07251 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -153,24 +153,6 @@ class OC_User {
}
/**
- * 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
*
* @param string $loginname The login name of the user to log in
diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php
index 6ae095fa5c2..d674ac27fa1 100644
--- a/tests/lib/files/cache/cache.php
+++ b/tests/lib/files/cache/cache.php
@@ -373,7 +373,8 @@ class Cache extends \Test\TestCase {
$tagManager->delete('tag2');
$this->logout();
- \OC_User::deleteUser($userId);
+ $user = \OC::$server->getUserManager()->get($userId);
+ if ($user !== null) { $user->delete(); }
}
function testMove() {
diff --git a/tests/lib/files/cache/updaterlegacy.php b/tests/lib/files/cache/updaterlegacy.php
index ca59850eb0b..09688afd465 100644
--- a/tests/lib/files/cache/updaterlegacy.php
+++ b/tests/lib/files/cache/updaterlegacy.php
@@ -72,7 +72,10 @@ class UpdaterLegacy extends \Test\TestCase {
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();
diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php
index 1de8cba5446..de8979affd1 100644
--- a/tests/lib/files/filesystem.php
+++ b/tests/lib/files/filesystem.php
@@ -340,7 +340,8 @@ class Filesystem extends \Test\TestCase {
$this->assertEquals('home::' . $userId, $homeMount->getId());
}
- \OC_User::deleteUser($userId);
+ $user = \OC::$server->getUserManager()->get($userId);
+ if ($user !== null) { $user->delete(); }
}
/**
@@ -368,7 +369,8 @@ class Filesystem extends \Test\TestCase {
$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();
}
@@ -398,7 +400,8 @@ class Filesystem extends \Test\TestCase {
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);
}
@@ -426,7 +429,8 @@ class Filesystem extends \Test\TestCase {
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);
}
diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/files/objectstore/swift.php
index 906efb6390f..a63f5844145 100644
--- a/tests/lib/files/objectstore/swift.php
+++ b/tests/lib/files/objectstore/swift.php
@@ -51,7 +51,8 @@ class Swift extends \Test\Files\Storage\Storage {
// 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);
}
@@ -76,7 +77,8 @@ class Swift extends \Test\Files\Storage\Storage {
$users = array('test');
foreach($users as $userName) {
- \OC_User::deleteUser($userName);
+ $user = \OC::$server->getUserManager()->get($userName);
+ if ($user !== null) { $user->delete(); }
}
parent::tearDown();
}
diff --git a/tests/lib/files/storage/homestoragequota.php b/tests/lib/files/storage/homestoragequota.php
index bee05438c80..9a3c6b151fc 100644
--- a/tests/lib/files/storage/homestoragequota.php
+++ b/tests/lib/files/storage/homestoragequota.php
@@ -44,7 +44,8 @@ class HomeStorageQuota extends \Test\TestCase {
// 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();
}
@@ -71,7 +72,8 @@ class HomeStorageQuota extends \Test\TestCase {
// 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();
}
diff --git a/tests/lib/helperstorage.php b/tests/lib/helperstorage.php
index 1b2d1ec4fea..3109b509549 100644
--- a/tests/lib/helperstorage.php
+++ b/tests/lib/helperstorage.php
@@ -45,7 +45,8 @@ class Test_Helper_Storage extends \Test\TestCase {
\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();
diff --git a/tests/lib/security/certificatemanager.php b/tests/lib/security/certificatemanager.php
index a4e6d8d68ac..f2e29cab18e 100644
--- a/tests/lib/security/certificatemanager.php
+++ b/tests/lib/security/certificatemanager.php
@@ -39,7 +39,8 @@ class CertificateManagerTest extends \Test\TestCase {
}
protected function tearDown() {
- \OC_User::deleteUser($this->username);
+ $user = \OC::$server->getUserManager()->get($this->username);
+ if ($user !== null) { $user->delete(); }
parent::tearDown();
}
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 273073239c9..5162a03f367 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -94,13 +94,20 @@ class Test_Share extends \Test\TestCase {
$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);
@@ -375,7 +382,8 @@ class Test_Share extends \Test\TestCase {
// 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));
}
diff --git a/tests/lib/user.php b/tests/lib/user.php
index 26596e2fb54..c4c74cbc254 100644
--- a/tests/lib/user.php
+++ b/tests/lib/user.php
@@ -51,15 +51,5 @@ class User extends TestCase {
$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);
- }
}