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() {
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);
/**
// 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);
}
if ($create) {
- \OC_User::createUser($user, $password);
+ \OC::$server->getUserManager()->createUser($user, $password);
\OC_Group::createGroup('group');
\OC_Group::addToGroup($user, 'group');
}
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
}
}
}
- /**
- * 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
*
\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');
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);
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');
public function testHomeMount() {
$userId = $this->getUniqueID('user_');
- \OC_User::createUser($userId, $userId);
+ \OC::$server->getUserManager()->createUser($userId, $userId);
\OC\Files\Filesystem::initMountPoints($userId);
// 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 . '/');
// 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(
$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(
$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
*/
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);
*/
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);
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();
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('');
$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);
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');
$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
$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());
- }
}