]> source.dussan.org Git - nextcloud-server.git/commitdiff
Removed deprecated private OC_User::createUser
authorRoeland Jago Douma <rullzer@owncloud.com>
Thu, 17 Dec 2015 14:10:11 +0000 (15:10 +0100)
committerRoeland Jago Douma <rullzer@owncloud.com>
Thu, 17 Dec 2015 15:18:40 +0000 (16:18 +0100)
All function calls are replaced with the recommended (which was already
the body of the function).

17 files changed:
apps/encryption/tests/lib/MigrationTest.php
apps/files/tests/service/tagservice.php
apps/files_sharing/tests/controller/sharecontroller.php
apps/files_sharing/tests/testcase.php
apps/files_trashbin/tests/trashbin.php
lib/private/user.php
tests/lib/cache/file.php
tests/lib/files/cache/cache.php
tests/lib/files/cache/updaterlegacy.php
tests/lib/files/filesystem.php
tests/lib/files/objectstore/swift.php
tests/lib/files/storage/homestoragequota.php
tests/lib/helperstorage.php
tests/lib/security/certificatemanager.php
tests/lib/share/share.php
tests/lib/tags.php
tests/lib/user.php

index fc3d014345b726059b3bfa05def14e7ada7947f4..ec1dccb87b80616f2652b0bb728760faffbd91eb 100644 (file)
@@ -43,9 +43,9 @@ 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() {
index 36da3edc61e7c1a3524c3eb188246db35dd1a369..a34bd05afcc5dcf04a49c41723dda08c2afe8cee 100644 (file)
@@ -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);
                /**
index 168488f5613c73edc5131fe119e047fb2f98b169..d165151b87f9556a45deb21f1d567572710a8fa9 100644 (file)
@@ -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);
 
index a74ee83c25be20f8230f6159082b5142e5991787..cc82fc3d949e93e7738bef0df2bc18b212e9b054 100644 (file)
@@ -149,7 +149,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');
                }
index db7e7e6e840c2d8e15c6106c6883d16242c8645c..e8d586816c3962734cd8c21b4129cf5a24197778 100644 (file)
@@ -636,7 +636,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
 
                        }
index 9094f388f9e9dfd5250c289dd53ddf69ed86aa95..3c011d5cc814c0132402a3554be8cc0c86aa01b6 100644 (file)
@@ -190,24 +190,6 @@ class OC_User {
                }
        }
 
-       /**
-        * Create a new user
-        *
-        * @param string $uid The username of the user to create
-        * @param string $password The password of the new user
-        * @throws Exception
-        * @return bool true/false
-        *
-        * Creates a new user. Basic checking of username is done in OC_User
-        * itself, not in its subclasses.
-        *
-        * Allowed characters in the username are: "a-z", "A-Z", "0-9" and "_.@-"
-        * @deprecated Use \OC::$server->getUserManager()->createUser($uid, $password)
-        */
-       public static function createUser($uid, $password) {
-               return \OC::$server->getUserManager()->createUser($uid, $password);
-       }
-
        /**
         * delete a user
         *
index 7aa969df02ce2263d4f5eb2b633a8b53755e38ab..0880e7e1282bb4ff0a927f5539d423ce27705505 100644 (file)
@@ -71,7 +71,7 @@ class FileCache extends \Test_Cache {
                \OC_User::useBackend(new \Test\Util\User\Dummy());
 
                //login
-               \OC_User::createUser('test', 'test');
+               \OC::$server->getUserManager()->createUser('test', 'test');
 
                $this->user = \OC_User::getUser();
                \OC_User::setUserId('test');
index 503d25597cd83f1db4560758b169410b6dd84388..6ae095fa5c2f01e8bf00aae1bfbc960ae93f77d9 100644 (file)
@@ -317,7 +317,7 @@ class Cache extends \Test\TestCase {
 
        function testSearchByTag() {
                $userId = $this->getUniqueId('user');
-               \OC_User::createUser($userId, $userId);
+               \OC::$server->getUserManager()->createUser($userId, $userId);
                $this->loginAsUser($userId);
                $user = new \OC\User\User($userId, null);
 
index 1946913bba4a4470d5f1b2ebc9bee390cf005732..ca59850eb0b3983d4a159414b9c734d53165fd60 100644 (file)
@@ -57,7 +57,7 @@ class UpdaterLegacy extends \Test\TestCase {
                        self::$user = $this->getUniqueID();
                }
 
-               \OC_User::createUser(self::$user, 'password');
+               \OC::$server->getUserManager()->createUser(self::$user, 'password');
                $this->loginAsUser(self::$user);
 
                Filesystem::init(self::$user, '/' . self::$user . '/files');
index c5ebbdd1a2d190024bb105c4360a873fa6e73d53..1de8cba54461a5bbdbe136e77fe3863cf3ad1c65 100644 (file)
@@ -325,7 +325,7 @@ class Filesystem extends \Test\TestCase {
        public function testHomeMount() {
                $userId = $this->getUniqueID('user_');
 
-               \OC_User::createUser($userId, $userId);
+               \OC::$server->getUserManager()->createUser($userId, $userId);
 
                \OC\Files\Filesystem::initMountPoints($userId);
 
@@ -360,7 +360,7 @@ class Filesystem extends \Test\TestCase {
                // this will trigger the insert
                $cache = $localStorage->getCache();
 
-               \OC_User::createUser($userId, $userId);
+               \OC::$server->getUserManager()->createUser($userId, $userId);
                \OC\Files\Filesystem::initMountPoints($userId);
 
                $homeMount = \OC\Files\Filesystem::getStorage('/' . $userId . '/');
@@ -388,7 +388,7 @@ class Filesystem extends \Test\TestCase {
                // no cache path configured
                $config->setSystemValue('cache_path', '');
 
-               \OC_User::createUser($userId, $userId);
+               \OC::$server->getUserManager()->createUser($userId, $userId);
                \OC\Files\Filesystem::initMountPoints($userId);
 
                $this->assertEquals(
@@ -416,7 +416,7 @@ class Filesystem extends \Test\TestCase {
                $cachePath = \OC_Helper::tmpFolder() . '/extcache';
                $config->setSystemValue('cache_path', $cachePath);
 
-               \OC_User::createUser($userId, $userId);
+               \OC::$server->getUserManager()->createUser($userId, $userId);
                \OC\Files\Filesystem::initMountPoints($userId);
 
                $this->assertEquals(
index 63332af68da5677c6a6ef885eef64f9afa7c2f26..906efb6390f0e97b03d99d4c2b83134f5df05ba0 100644 (file)
@@ -52,7 +52,7 @@ class Swift extends \Test\Files\Storage\Storage {
                $users = array('test');
                foreach($users as $userName) {
                        \OC_User::deleteUser($userName);
-                       \OC_User::createUser($userName, $userName);
+                       \OC::$server->getUserManager()->createUser($userName, $userName);
                }
 
                // main test user
index 49e8f499efdb50ddac4e4e6000f8469e8484b585..bee05438c80cdeed07e7032abf39fac6231cda2c 100644 (file)
@@ -32,7 +32,7 @@ class HomeStorageQuota extends \Test\TestCase {
         */
        function testHomeStorageWrapperWithoutQuota() {
                $user1 = $this->getUniqueID();
-               \OC_User::createUser($user1, 'test');
+               \OC::$server->getUserManager()->createUser($user1, 'test');
                \OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', 'none');
                \OC_User::setUserId($user1);
 
@@ -54,7 +54,7 @@ class HomeStorageQuota extends \Test\TestCase {
         */
        function testHomeStorageWrapperWithQuota() {
                $user1 = $this->getUniqueID();
-               \OC_User::createUser($user1, 'test');
+               \OC::$server->getUserManager()->createUser($user1, 'test');
                \OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', '1024');
                \OC_User::setUserId($user1);
 
index cf022109c278a1a4a4b330a1e9c4da9312e83f49..1b2d1ec4feae93183aad550a6a5cfae20b37eb46 100644 (file)
@@ -23,7 +23,7 @@ class Test_Helper_Storage extends \Test\TestCase {
                parent::setUp();
 
                $this->user = $this->getUniqueID('user_');
-               \OC_User::createUser($this->user, $this->user);
+               \OC::$server->getUserManager()->createUser($this->user, $this->user);
 
                $this->storage = \OC\Files\Filesystem::getStorage('/');
                \OC\Files\Filesystem::tearDown();
index 43b2f1cf9802fba2c221c9ec530d4d11b279d9d0..a4e6d8d68ac6f73a5a82a13761b7bd5327f0758b 100644 (file)
@@ -24,7 +24,7 @@ class CertificateManagerTest extends \Test\TestCase {
                parent::setUp();
 
                $this->username = $this->getUniqueID('', 20);
-               OC_User::createUser($this->username, $this->getUniqueID('', 20));
+               \OC::$server->getUserManager()->createUser($this->username, $this->getUniqueID('', 20));
 
                \OC_Util::tearDownFS();
                \OC_User::setUserId('');
index fa19577cb72a8e60ed75d8cfb8b16935fbf59c2e..273073239c98db9ef14a63538e386f2d2fcc5165 100644 (file)
@@ -54,13 +54,13 @@ class Test_Share extends \Test\TestCase {
                $this->user5 = $this->getUniqueID('user5_');
                $this->user6 = $this->getUniqueID('user6_');
                $this->groupAndUser = $this->getUniqueID('groupAndUser_');
-               OC_User::createUser($this->user1, 'pass');
-               OC_User::createUser($this->user2, 'pass');
-               OC_User::createUser($this->user3, 'pass');
-               OC_User::createUser($this->user4, 'pass');
-               OC_User::createUser($this->user5, 'pass');
-               OC_User::createUser($this->user6, 'pass'); // no group
-               OC_User::createUser($this->groupAndUser, 'pass');
+               \OC::$server->getUserManager()->createUser($this->user1, 'pass');
+               \OC::$server->getUserManager()->createUser($this->user2, 'pass');
+               \OC::$server->getUserManager()->createUser($this->user3, 'pass');
+               \OC::$server->getUserManager()->createUser($this->user4, 'pass');
+               \OC::$server->getUserManager()->createUser($this->user5, 'pass');
+               \OC::$server->getUserManager()->createUser($this->user6, 'pass'); // no group
+               \OC::$server->getUserManager()->createUser($this->groupAndUser, 'pass');
                OC_User::setUserId($this->user1);
                OC_Group::clearBackends();
                OC_Group::useBackend(new OC_Group_Dummy);
index a8f59ff16e447a21ca8164b15725e2a7943908d0..537c898da131207850f5d221f5ee759f2df1e151 100644 (file)
@@ -44,7 +44,7 @@ class Test_Tags extends \Test\TestCase {
                OC_User::clearBackends();
                OC_User::useBackend('dummy');
                $userId = $this->getUniqueID('user_');
-               OC_User::createUser($userId, 'pass');
+               \OC::$server->getUserManager()->createUser($userId, 'pass');
                OC_User::setUserId($userId);
                $this->user = new OC\User\User($userId, null);
                $this->userSession = $this->getMock('\OCP\IUserSession');
@@ -290,7 +290,7 @@ class Test_Tags extends \Test\TestCase {
                $tagger->tagAs(1, $testTag);
 
                $otherUserId = $this->getUniqueID('user2_');
-               OC_User::createUser($otherUserId, 'pass');
+               \OC::$server->getUserManager()->createUser($otherUserId, 'pass');
                OC_User::setUserId($otherUserId);
                $otherUserSession = $this->getMock('\OCP\IUserSession');
                $otherUserSession
index 5e9a38a43c0d2f4195ce280212662ce59f96b43e..26596e2fb540406e22d03e052ccc9e9634db27c5 100644 (file)
@@ -56,25 +56,10 @@ class User extends TestCase {
                $fail = \OC_User::deleteUser('victim');
                $this->assertFalse($fail);
                
-               $success = \OC_User::createUser('victim', 'password');
+               $success = \OC::$server->getUserManager()->createUser('victim', 'password');
                
                $success = \OC_User::deleteUser('victim');
                $this->assertTrue($success);
        }
-       
-       public function testCreateUser(){
-               $this->backend->expects($this->any())
-                       ->method('implementsActions')
-                       ->will($this->returnCallback(function ($actions) {
-                               if ($actions === \OC_USER_BACKEND_CREATE_USER) {
-                                       return true;
-                               } else {
-                                       return false;
-                               }
-                       }));
-                       
-               $user = \OC_User::createUser('newuser', 'newpassword');
-               $this->assertEquals('newuser', $user->getUid());
-       }
 
 }