Fix the storage info and other checks when the user has wrong casing
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
1c2cdc9d3a
commit
992c48c89b
|
@ -278,10 +278,10 @@ class UsersController extends OCSController {
|
||||||
// Admin? Or SubAdmin?
|
// Admin? Or SubAdmin?
|
||||||
if($this->groupManager->isAdmin($currentLoggedInUser->getUID())
|
if($this->groupManager->isAdmin($currentLoggedInUser->getUID())
|
||||||
|| $this->groupManager->getSubAdmin()->isUserAccessible($currentLoggedInUser, $targetUserObject)) {
|
|| $this->groupManager->getSubAdmin()->isUserAccessible($currentLoggedInUser, $targetUserObject)) {
|
||||||
$data['enabled'] = $this->config->getUserValue($userId, 'core', 'enabled', 'true');
|
$data['enabled'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'enabled', 'true');
|
||||||
} else {
|
} else {
|
||||||
// Check they are looking up themselves
|
// Check they are looking up themselves
|
||||||
if($currentLoggedInUser->getUID() !== $userId) {
|
if($currentLoggedInUser->getUID() !== $targetUserObject->getUID()) {
|
||||||
throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
|
throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ class UsersController extends OCSController {
|
||||||
|
|
||||||
// Find the data
|
// Find the data
|
||||||
$data['id'] = $targetUserObject->getUID();
|
$data['id'] = $targetUserObject->getUID();
|
||||||
$data['quota'] = $this->fillStorageInfo($userId);
|
$data['quota'] = $this->fillStorageInfo($targetUserObject->getUID());
|
||||||
$data[AccountManager::PROPERTY_EMAIL] = $targetUserObject->getEMailAddress();
|
$data[AccountManager::PROPERTY_EMAIL] = $targetUserObject->getEMailAddress();
|
||||||
$data[AccountManager::PROPERTY_DISPLAYNAME] = $targetUserObject->getDisplayName();
|
$data[AccountManager::PROPERTY_DISPLAYNAME] = $targetUserObject->getDisplayName();
|
||||||
$data[AccountManager::PROPERTY_PHONE] = $userAccount[AccountManager::PROPERTY_PHONE]['value'];
|
$data[AccountManager::PROPERTY_PHONE] = $userAccount[AccountManager::PROPERTY_PHONE]['value'];
|
||||||
|
@ -330,7 +330,7 @@ class UsersController extends OCSController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$permittedFields = [];
|
$permittedFields = [];
|
||||||
if($userId === $currentLoggedInUser->getUID()) {
|
if($targetUser->getUID() === $currentLoggedInUser->getUID()) {
|
||||||
// Editing self (display, email)
|
// Editing self (display, email)
|
||||||
$permittedFields[] = 'display';
|
$permittedFields[] = 'display';
|
||||||
$permittedFields[] = AccountManager::PROPERTY_DISPLAYNAME;
|
$permittedFields[] = AccountManager::PROPERTY_DISPLAYNAME;
|
||||||
|
@ -618,7 +618,7 @@ class UsersController extends OCSController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check they aren't removing themselves from 'admin' or their 'subadmin; group
|
// Check they aren't removing themselves from 'admin' or their 'subadmin; group
|
||||||
if ($userId === $loggedInUser->getUID()) {
|
if ($targetUser->getUID() === $loggedInUser->getUID()) {
|
||||||
if ($this->groupManager->isAdmin($loggedInUser->getUID())) {
|
if ($this->groupManager->isAdmin($loggedInUser->getUID())) {
|
||||||
if ($group->getGID() === 'admin') {
|
if ($group->getGID() === 'admin') {
|
||||||
throw new OCSException('Cannot remove yourself from the admin group', 105);
|
throw new OCSException('Cannot remove yourself from the admin group', 105);
|
||||||
|
|
|
@ -705,19 +705,19 @@ class UsersControllerTest extends TestCase {
|
||||||
$this->config
|
$this->config
|
||||||
->expects($this->at(0))
|
->expects($this->at(0))
|
||||||
->method('getUserValue')
|
->method('getUserValue')
|
||||||
->with('UserToGet', 'core', 'enabled', 'true')
|
->with('UID', 'core', 'enabled', 'true')
|
||||||
->will($this->returnValue('true'));
|
->will($this->returnValue('true'));
|
||||||
$this->api
|
$this->api
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('fillStorageInfo')
|
->method('fillStorageInfo')
|
||||||
->with('UserToGet')
|
->with('UID')
|
||||||
->will($this->returnValue(['DummyValue']));
|
->will($this->returnValue(['DummyValue']));
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getDisplayName')
|
->method('getDisplayName')
|
||||||
->will($this->returnValue('Demo User'));
|
->will($this->returnValue('Demo User'));
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->exactly(3))
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UID'));
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
|
@ -784,19 +784,19 @@ class UsersControllerTest extends TestCase {
|
||||||
$this->config
|
$this->config
|
||||||
->expects($this->at(0))
|
->expects($this->at(0))
|
||||||
->method('getUserValue')
|
->method('getUserValue')
|
||||||
->with('UserToGet', 'core', 'enabled', 'true')
|
->with('UID', 'core', 'enabled', 'true')
|
||||||
->will($this->returnValue('true'));
|
->will($this->returnValue('true'));
|
||||||
$this->api
|
$this->api
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('fillStorageInfo')
|
->method('fillStorageInfo')
|
||||||
->with('UserToGet')
|
->with('UID')
|
||||||
->will($this->returnValue(['DummyValue']));
|
->will($this->returnValue(['DummyValue']));
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getDisplayName')
|
->method('getDisplayName')
|
||||||
->will($this->returnValue('Demo User'));
|
->will($this->returnValue('Demo User'));
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->exactly(3))
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UID'));
|
->will($this->returnValue('UID'));
|
||||||
$this->accountManager->expects($this->any())->method('getUser')
|
$this->accountManager->expects($this->any())->method('getUser')
|
||||||
|
@ -878,7 +878,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->exactly(2))
|
->expects($this->exactly(2))
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('subadmin'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder(IUser::class)
|
$targetUser = $this->getMockBuilder(IUser::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
@ -894,7 +894,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$this->groupManager
|
$this->groupManager
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('isAdmin')
|
->method('isAdmin')
|
||||||
->with('subadmin')
|
->with('UID')
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
|
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@ -915,7 +915,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$this->api
|
$this->api
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('fillStorageInfo')
|
->method('fillStorageInfo')
|
||||||
->with('subadmin')
|
->with('UID')
|
||||||
->will($this->returnValue(['DummyValue']));
|
->will($this->returnValue(['DummyValue']));
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -926,7 +926,7 @@ class UsersControllerTest extends TestCase {
|
||||||
->method('getEMailAddress')
|
->method('getEMailAddress')
|
||||||
->will($this->returnValue('subadmin@owncloud.org'));
|
->will($this->returnValue('subadmin@owncloud.org'));
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->exactly(3))
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UID'));
|
->will($this->returnValue('UID'));
|
||||||
$this->accountManager->expects($this->any())->method('getUser')
|
$this->accountManager->expects($this->any())->method('getUser')
|
||||||
|
@ -961,7 +961,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToEdit'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder(IUser::class)
|
$targetUser = $this->getMockBuilder(IUser::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
@ -978,6 +978,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('setDisplayName')
|
->method('setDisplayName')
|
||||||
->with('NewDisplayName');
|
->with('NewDisplayName');
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->assertEquals([], $this->api->editUser('UserToEdit', 'display', 'NewDisplayName')->getData());
|
$this->assertEquals([], $this->api->editUser('UserToEdit', 'display', 'NewDisplayName')->getData());
|
||||||
}
|
}
|
||||||
|
@ -989,7 +993,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToEdit'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder(IUser::class)
|
$targetUser = $this->getMockBuilder(IUser::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
@ -1006,6 +1010,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('setEMailAddress')
|
->method('setEMailAddress')
|
||||||
->with('demo@owncloud.org');
|
->with('demo@owncloud.org');
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->assertEquals([], $this->api->editUser('UserToEdit', 'email', 'demo@owncloud.org')->getData());
|
$this->assertEquals([], $this->api->editUser('UserToEdit', 'email', 'demo@owncloud.org')->getData());
|
||||||
}
|
}
|
||||||
|
@ -1022,7 +1030,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToEdit'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder(IUser::class)
|
$targetUser = $this->getMockBuilder(IUser::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
@ -1035,6 +1043,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('UserToEdit')
|
->with('UserToEdit')
|
||||||
->will($this->returnValue($targetUser));
|
->will($this->returnValue($targetUser));
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->api->editUser('UserToEdit', 'email', 'demo.org');
|
$this->api->editUser('UserToEdit', 'email', 'demo.org');
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1058,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToEdit'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder(IUser::class)
|
$targetUser = $this->getMockBuilder(IUser::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
@ -1063,6 +1075,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('setPassword')
|
->method('setPassword')
|
||||||
->with('NewPassword');
|
->with('NewPassword');
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->assertEquals([], $this->api->editUser('UserToEdit', 'password', 'NewPassword')->getData());
|
$this->assertEquals([], $this->api->editUser('UserToEdit', 'password', 'NewPassword')->getData());
|
||||||
}
|
}
|
||||||
|
@ -1079,7 +1095,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToEdit'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder(IUser::class)
|
$targetUser = $this->getMockBuilder(IUser::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
@ -1092,6 +1108,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('UserToEdit')
|
->with('UserToEdit')
|
||||||
->will($this->returnValue($targetUser));
|
->will($this->returnValue($targetUser));
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->api->editUser('UserToEdit', 'quota', 'NewQuota');
|
$this->api->editUser('UserToEdit', 'quota', 'NewQuota');
|
||||||
}
|
}
|
||||||
|
@ -1101,7 +1121,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToEdit'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
||||||
$targetUser->expects($this->once())
|
$targetUser->expects($this->once())
|
||||||
->method('setQuota')
|
->method('setQuota')
|
||||||
|
@ -1118,8 +1138,12 @@ class UsersControllerTest extends TestCase {
|
||||||
$this->groupManager
|
$this->groupManager
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('isAdmin')
|
->method('isAdmin')
|
||||||
->with('UserToEdit')
|
->with('UID')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
|
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
|
||||||
}
|
}
|
||||||
|
@ -1135,7 +1159,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToEdit'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -1149,8 +1173,12 @@ class UsersControllerTest extends TestCase {
|
||||||
$this->groupManager
|
$this->groupManager
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('isAdmin')
|
->method('isAdmin')
|
||||||
->with('UserToEdit')
|
->with('UID')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->api->editUser('UserToEdit', 'quota', 'ABC');
|
$this->api->editUser('UserToEdit', 'quota', 'ABC');
|
||||||
}
|
}
|
||||||
|
@ -1186,6 +1214,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getSubAdmin')
|
->method('getSubAdmin')
|
||||||
->will($this->returnValue($subAdminManager));
|
->will($this->returnValue($subAdminManager));
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
|
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
|
||||||
}
|
}
|
||||||
|
@ -1221,6 +1253,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getSubAdmin')
|
->method('getSubAdmin')
|
||||||
->will($this->returnValue($subAdminManager));
|
->will($this->returnValue($subAdminManager));
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
|
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
|
||||||
}
|
}
|
||||||
|
@ -1257,6 +1293,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getSubAdmin')
|
->method('getSubAdmin')
|
||||||
->will($this->returnValue($subAdminManager));
|
->will($this->returnValue($subAdminManager));
|
||||||
|
$targetUser
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('UID'));
|
||||||
|
|
||||||
$this->api->editUser('UserToEdit', 'quota', 'value');
|
$this->api->editUser('UserToEdit', 'quota', 'value');
|
||||||
}
|
}
|
||||||
|
@ -1293,12 +1333,12 @@ class UsersControllerTest extends TestCase {
|
||||||
$loggedInUser
|
$loggedInUser
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToDelete'));
|
->will($this->returnValue('UID'));
|
||||||
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToDelete'));
|
->will($this->returnValue('UID'));
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
|
@ -1322,7 +1362,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToDelete'));
|
->will($this->returnValue('UID'));
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
|
@ -1359,7 +1399,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToDelete'));
|
->will($this->returnValue('UID'));
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
|
@ -1392,7 +1432,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToDelete'));
|
->will($this->returnValue('UID'));
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
|
@ -1440,7 +1480,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToDelete'));
|
->will($this->returnValue('UID'));
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
|
@ -1488,7 +1528,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$targetUser
|
$targetUser
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('UserToDelete'));
|
->will($this->returnValue('UID'));
|
||||||
$this->userSession
|
$this->userSession
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
|
@ -1984,6 +2024,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('admin'));
|
->will($this->returnValue('admin'));
|
||||||
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
||||||
|
$targetUser
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('admin'));
|
||||||
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
|
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
|
||||||
$targetGroup
|
$targetGroup
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -2001,7 +2045,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$this->userManager
|
$this->userManager
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('admin')
|
->with('Admin')
|
||||||
->will($this->returnValue($targetUser));
|
->will($this->returnValue($targetUser));
|
||||||
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
|
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
|
||||||
->disableOriginalConstructor()->getMock();
|
->disableOriginalConstructor()->getMock();
|
||||||
|
@ -2015,7 +2059,7 @@ class UsersControllerTest extends TestCase {
|
||||||
->with('admin')
|
->with('admin')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
$this->api->removeFromGroup('admin', 'admin');
|
$this->api->removeFromGroup('Admin', 'admin');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2030,6 +2074,10 @@ class UsersControllerTest extends TestCase {
|
||||||
->method('getUID')
|
->method('getUID')
|
||||||
->will($this->returnValue('subadmin'));
|
->will($this->returnValue('subadmin'));
|
||||||
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
|
||||||
|
$targetUser
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('subadmin'));
|
||||||
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
|
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
|
||||||
$targetGroup
|
$targetGroup
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
|
@ -2047,7 +2095,7 @@ class UsersControllerTest extends TestCase {
|
||||||
$this->userManager
|
$this->userManager
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('subadmin')
|
->with('SubAdmin')
|
||||||
->will($this->returnValue($targetUser));
|
->will($this->returnValue($targetUser));
|
||||||
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
|
$subAdminManager = $this->getMockBuilder('OC\SubAdmin')
|
||||||
->disableOriginalConstructor()->getMock();
|
->disableOriginalConstructor()->getMock();
|
||||||
|
@ -2066,7 +2114,7 @@ class UsersControllerTest extends TestCase {
|
||||||
->with('subadmin')
|
->with('subadmin')
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
|
|
||||||
$this->api->removeFromGroup('subadmin', 'subadmin');
|
$this->api->removeFromGroup('SubAdmin', 'subadmin');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue