diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php index 0ed6d58e217383806b9f25afc2927623897f0ce0..34bcdd4e64504c8c05a2db7cca76d60c19efcfc8 100644 --- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php +++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php @@ -75,13 +75,13 @@ class GroupsControllerTest extends \Test\TestCase { $this->userSession = $this->createMock(IUserSession::class); $this->accountManager = $this->createMock(AccountManager::class); $this->logger = $this->createMock(ILogger::class); - + $this->subAdminManager = $this->createMock(SubAdmin::class); $this->groupManager ->method('getSubAdmin') ->willReturn($this->subAdminManager); - + $this->api = $this->getMockBuilder(GroupsController::class) ->setConstructorArgs([ 'provisioning_api', @@ -256,7 +256,6 @@ class GroupsControllerTest extends \Test\TestCase { 'disabled' => 11, 'canAdd' => true, 'canRemove' => true - ] ]], $result->getData()); } @@ -285,7 +284,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->assertEquals(['users' => ['user1', 'user2']], $result->getData()); } - + public function testGetGroupAsIrrelevantSubadmin() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(403); @@ -330,7 +329,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->assertEquals(['users' => ['user1', 'user2']], $result->getData()); } - + public function testGetGroupNonExisting() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('The requested group could not be found'); @@ -341,7 +340,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->getGroup($this->getUniqueID()); } - + public function testGetSubAdminsOfGroupsNotExists() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Group does not exist'); @@ -388,7 +387,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->assertEquals([], $result->getData()); } - + public function testAddGroupEmptyGroup() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Invalid group name'); @@ -397,7 +396,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->addGroup(''); } - + public function testAddGroupExistingGroup() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(102); @@ -438,7 +437,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->addGroup('Iñtërnâtiônà lizætiøn'); } - + public function testDeleteGroupNonExisting() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(101); @@ -446,7 +445,7 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->deleteGroup('NonExistingGroup'); } - + public function testDeleteAdminGroup() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionCode(102); @@ -478,6 +477,25 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->deleteGroup('ExistingGroup'); } + public function testDeleteGroupEncoding() { + $this->groupManager + ->method('groupExists') + ->with('ExistingGroup A/B') + ->willReturn('true'); + + $group = $this->createGroup('ExistingGroup'); + $this->groupManager + ->method('get') + ->with('ExistingGroup A/B') + ->willReturn($group); + $group + ->expects($this->once()) + ->method('delete') + ->willReturn(true); + + $this->api->deleteGroup(urlencode('ExistingGroup A/B')); + } + public function testGetGroupUsersDetails() { $gid = 'ncg1'; @@ -523,4 +541,50 @@ class GroupsControllerTest extends \Test\TestCase { $this->api->getGroupUsersDetails($gid); } + + public function testGetGroupUsersDetailsEncoded() { + $gid = 'Department A/B C/D'; + + $this->asAdmin(); + $this->useAccountManager(); + + $users = [ + 'ncu1' => $this->createUser('ncu1'), # regular + 'ncu2' => $this->createUser('ncu2'), # the zombie + ]; + $users['ncu2']->expects($this->atLeastOnce()) + ->method('getHome') + ->willThrowException(new NoUserException()); + + $this->userManager->expects($this->any()) + ->method('get') + ->willReturnCallback(function(string $uid) use ($users) { + return isset($users[$uid]) ? $users[$uid] : null; + }); + + $group = $this->createGroup($gid); + $group->expects($this->once()) + ->method('searchUsers') + ->with('', null, 0) + ->willReturn(array_values($users)); + + $this->groupManager + ->method('get') + ->with($gid) + ->willReturn($group); + $this->groupManager->expects($this->any()) + ->method('getUserGroups') + ->willReturn([$group]); + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + $this->subAdminManager->expects($this->any()) + ->method('isSubAdminOfGroup') + ->willReturn(false); + $this->subAdminManager->expects($this->any()) + ->method('getSubAdminsGroups') + ->willReturn([]); + + + $this->api->getGroupUsersDetails(urlencode($gid)); + } } diff --git a/apps/settings/js/vue-6.js b/apps/settings/js/vue-6.js index 1e149e192d0f70199bc62afce75ee0ddc84af5f3..9ecff6edfcf1032420c3723d8a24137d6ff5b600 100644 Binary files a/apps/settings/js/vue-6.js and b/apps/settings/js/vue-6.js differ diff --git a/apps/settings/js/vue-6.js.map b/apps/settings/js/vue-6.js.map index 67d68a09e573fed5945e011e2f3c726f70f92d45..255f5b85d35dddeff54eb6941244a6d933aba070 100644 Binary files a/apps/settings/js/vue-6.js.map and b/apps/settings/js/vue-6.js.map differ diff --git a/apps/settings/js/vue-settings-apps-users-management.js b/apps/settings/js/vue-settings-apps-users-management.js index b1449d33ebb43e5b4b490c919478da1098d6acd1..a1cde0dff88ab5adde4dd4eb6dfd7bc7aeae41d7 100644 Binary files a/apps/settings/js/vue-settings-apps-users-management.js and b/apps/settings/js/vue-settings-apps-users-management.js differ diff --git a/apps/settings/js/vue-settings-apps-users-management.js.map b/apps/settings/js/vue-settings-apps-users-management.js.map index c8277b5284aa6211bdceee07b180573d8068d103..217763eeb6fbb88a155697bc9c620f902684351b 100644 Binary files a/apps/settings/js/vue-settings-apps-users-management.js.map and b/apps/settings/js/vue-settings-apps-users-management.js.map differ