summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-18 10:15:18 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-18 10:15:18 +0100
commit551e553bf4f6cda7c559429cc6f0c40d3eb15d0b (patch)
treef12265708d4f4c0a617252b286c6482740da8ff7 /apps
parent1456e910adc072cc27c06623394d334dd33ad0f6 (diff)
parent1f715289bf1cafb7e51dce7a4ab478dd3db5088e (diff)
downloadnextcloud-server-551e553bf4f6cda7c559429cc6f0c40d3eb15d0b.tar.gz
nextcloud-server-551e553bf4f6cda7c559429cc6f0c40d3eb15d0b.zip
Merge pull request #21264 from owncloud/deprecated_oc_user_methods
Cleanup OC_User deprecated methods
Diffstat (limited to 'apps')
-rw-r--r--apps/encryption/tests/lib/MigrationTest.php15
-rw-r--r--apps/files/appinfo/register_command.php2
-rw-r--r--apps/files/tests/service/tagservice.php5
-rw-r--r--apps/files_sharing/tests/controller/sharecontroller.php5
-rw-r--r--apps/files_sharing/tests/testcase.php11
-rw-r--r--apps/files_trashbin/tests/storage.php3
-rw-r--r--apps/files_trashbin/tests/trashbin.php5
-rw-r--r--apps/files_versions/tests/versions.php6
8 files changed, 32 insertions, 20 deletions
diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/lib/MigrationTest.php
index fc3d014345b..6df72ac1bf6 100644
--- a/apps/encryption/tests/lib/MigrationTest.php
+++ b/apps/encryption/tests/lib/MigrationTest.php
@@ -43,15 +43,18 @@ class MigrationTest extends \Test\TestCase {
public static function setUpBeforeClass() {
parent::setUpBeforeClass();
- \OC_User::createUser(self::TEST_ENCRYPTION_MIGRATION_USER1, 'foo');
- \OC_User::createUser(self::TEST_ENCRYPTION_MIGRATION_USER2, 'foo');
- \OC_User::createUser(self::TEST_ENCRYPTION_MIGRATION_USER3, 'foo');
+ \OC::$server->getUserManager()->createUser(self::TEST_ENCRYPTION_MIGRATION_USER1, 'foo');
+ \OC::$server->getUserManager()->createUser(self::TEST_ENCRYPTION_MIGRATION_USER2, 'foo');
+ \OC::$server->getUserManager()->createUser(self::TEST_ENCRYPTION_MIGRATION_USER3, 'foo');
}
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/appinfo/register_command.php b/apps/files/appinfo/register_command.php
index 3042c259872..7e541ca26f2 100644
--- a/apps/files/appinfo/register_command.php
+++ b/apps/files/appinfo/register_command.php
@@ -20,5 +20,5 @@
*
*/
-$application->add(new OCA\Files\Command\Scan(OC_User::getManager()));
+$application->add(new OCA\Files\Command\Scan(\OC::$server->getUserManager()));
$application->add(new OCA\Files\Command\DeleteOrphanedFiles(\OC::$server->getDatabaseConnection()));
diff --git a/apps/files/tests/service/tagservice.php b/apps/files/tests/service/tagservice.php
index 36da3edc61e..b93dedd0efd 100644
--- a/apps/files/tests/service/tagservice.php
+++ b/apps/files/tests/service/tagservice.php
@@ -54,7 +54,7 @@ class TagServiceTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
$this->user = $this->getUniqueId('user');
- \OC_User::createUser($this->user, 'test');
+ \OC::$server->getUserManager()->createUser($this->user, 'test');
\OC_User::setUserId($this->user);
\OC_Util::setupFS($this->user);
/**
@@ -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 168488f5613..398538f0943 100644
--- a/apps/files_sharing/tests/controller/sharecontroller.php
+++ b/apps/files_sharing/tests/controller/sharecontroller.php
@@ -78,7 +78,7 @@ class ShareControllerTest extends \Test\TestCase {
// Create a dummy user
$this->user = \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(12, ISecureRandom::CHAR_LOWER);
- \OC_User::createUser($this->user, $this->user);
+ \OC::$server->getUserManager()->createUser($this->user, $this->user);
\OC_Util::tearDownFS();
$this->loginAsUser($this->user);
@@ -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 a74ee83c25b..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);
@@ -149,7 +152,7 @@ abstract class TestCase extends \Test\TestCase {
}
if ($create) {
- \OC_User::createUser($user, $password);
+ \OC::$server->getUserManager()->createUser($user, $password);
\OC_Group::createGroup('group');
\OC_Group::addToGroup($user, 'group');
}
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 db7e7e6e840..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);
@@ -636,7 +637,7 @@ class Test_Trashbin extends \Test\TestCase {
public static function loginHelper($user, $create = false) {
if ($create) {
try {
- \OC_User::createUser($user, $user);
+ \OC::$server->getUserManager()->createUser($user, $user);
} catch(\Exception $e) { // catch username is already being used from previous aborted runs
}
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();
}