diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 386d9bfefcf8..dda2330a3187 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -105,10 +105,10 @@ protected function configure() { 'Limit rescan to this path, e.g., --path="/alice/files/Music", the user_id is determined by the path and the user_id parameter and --all are ignored.' ) ->addOption( - 'groups', + 'group', 'g', - InputArgument::OPTIONAL, - 'Scan user(s) under the group(s). This option can be used as --groups=foo,bar to scan groups foo and bar' + InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, + 'Scan user(s) under the group(s). This option can be used as --group=foo --group=bar to scan groups foo and bar' ) ->addOption( 'quiet', @@ -276,7 +276,7 @@ protected function getAllUsersFromGroup($group) { protected function execute(InputInterface $input, OutputInterface $output) { $inputPath = $input->getOption('path'); - $groups = $input->getOption('groups') ? \explode(',', $input->getOption('groups')) : []; + $groups = $input->getOption('group'); $shouldRepairStoragesIndividually = (bool) $input->getOption('repair'); if (\count($groups) >= 1) { diff --git a/apps/files/tests/Command/ScanTest.php b/apps/files/tests/Command/ScanTest.php index c21001280e03..94e7e290d1bd 100644 --- a/apps/files/tests/Command/ScanTest.php +++ b/apps/files/tests/Command/ScanTest.php @@ -140,8 +140,9 @@ protected function tearDown() { public function dataInput() { return [ - [['--groups' => 'haystack'], 'Group name haystack doesn\'t exist'], - [['--groups' => 'group1'], 'Starting scan for user 1 out of 1 (user1)'], + [['--group' => ['haystack']], 'Group name haystack doesn\'t exist'], + [['--group' => ['haystack,barn']], 'Group name haystack,barn doesn\'t exist'], + [['--group' => ['group1']], 'Starting scan for user 1 out of 1 (user1)'], [['user_id' => ['user1']], 'Starting scan for user 1 out of 1 (user1)'], [['user_id' => ['user2']], 'Starting scan for user 1 out of 1 (user2)'] ]; @@ -158,7 +159,7 @@ public function testCommandInput($input, $expectedOutput) { public function userInputData() { return [ - [['--groups' => 'group1'], 'Starting scan for user 1 out of 200'] + [['--group' => ['group1']], 'Starting scan for user 1 out of 200'] ]; } @@ -171,7 +172,7 @@ public function testGroupPaginationForUsers($input, $expectedOutput) { //First we populate the users $user = 'user'; $numberOfUsersInGroup = 210; - for ($i = 2; $i <= 210; $i++) { + for ($i = 2; $i <= $numberOfUsersInGroup; $i++) { $userObj = $this->createUser($user.$i); $this->groupManager->get('group1')->addUser($userObj); } @@ -180,13 +181,13 @@ public function testGroupPaginationForUsers($input, $expectedOutput) { $output = $this->commandTester->getDisplay(); $this->assertContains($expectedOutput, $output); //If pagination works then below assert shouldn't fail - $this->assertNotContains('Starting scan for user 1 out of 210', $output); + $this->assertNotContains("Starting scan for user 1 out of $numberOfUsersInGroup", $output); } public function multipleGroupTest() { return [ - [['--groups' => 'group1,group2'], ''], - [['--groups' => 'group1,group2,group3'], ''] + [['--group' => ['group1,x','group2']], ''], + [['--group' => ['group1','group2,x','group3']], ''] ]; } @@ -196,7 +197,7 @@ public function multipleGroupTest() { */ public function testMultipleGroups($input) { //Create 10 users in each group - $groups = \explode(',', $input['--groups']); + $groups = $input['--group']; $user = "user"; $userObj = []; for ($i = 1; $i <= (10 * \count($groups)); $i++) { diff --git a/tests/acceptance/features/apiProvisioning-v1/addGroup.feature b/tests/acceptance/features/apiProvisioning-v1/addGroup.feature index 7a868a2384e3..27e3a7033267 100644 --- a/tests/acceptance/features/apiProvisioning-v1/addGroup.feature +++ b/tests/acceptance/features/apiProvisioning-v1/addGroup.feature @@ -16,6 +16,7 @@ So that I can more easily manage access to resources by groups rather than indiv | group_id | comment | | new-group | dash | | the.group | dot | + | left,right | comma | | España | special European characters | | नेपाली | Unicode group name | | 0 | The "false" group | diff --git a/tests/acceptance/features/apiProvisioning-v1/addToGroup.feature b/tests/acceptance/features/apiProvisioning-v1/addToGroup.feature index c9207b939455..98bf13f20876 100644 --- a/tests/acceptance/features/apiProvisioning-v1/addToGroup.feature +++ b/tests/acceptance/features/apiProvisioning-v1/addToGroup.feature @@ -18,6 +18,7 @@ So that I can give a user access to the resources of the group | group_id | comment | | new-group | dash | | the.group | dot | + | left,right | comma | | España | special European characters | | नेपाली | Unicode group name | | 0 | The "false" group | diff --git a/tests/acceptance/features/apiProvisioning-v1/deleteGroup.feature b/tests/acceptance/features/apiProvisioning-v1/deleteGroup.feature index df52746f8f85..123174f0e822 100644 --- a/tests/acceptance/features/apiProvisioning-v1/deleteGroup.feature +++ b/tests/acceptance/features/apiProvisioning-v1/deleteGroup.feature @@ -17,6 +17,7 @@ So that I can remove unnecessary groups | group_id | comment | | new-group | dash | | the.group | dot | + | left,right | comma | | España | special European characters | | नेपाली | Unicode group name | | 0 | The "false" group | diff --git a/tests/acceptance/features/apiProvisioning-v1/removeFromGroup.feature b/tests/acceptance/features/apiProvisioning-v1/removeFromGroup.feature index 883bcc0ee29e..4d0fdd7475db 100644 --- a/tests/acceptance/features/apiProvisioning-v1/removeFromGroup.feature +++ b/tests/acceptance/features/apiProvisioning-v1/removeFromGroup.feature @@ -20,6 +20,7 @@ So that I can manage user access to group resources | group_id | comment | | new-group | dash | | the.group | dot | + | left,right | comma | | España | special European characters | | नेपाली | Unicode group name | | 0 | The "false" group | diff --git a/tests/acceptance/features/apiProvisioning-v2/addGroup.feature b/tests/acceptance/features/apiProvisioning-v2/addGroup.feature index 200882c1b3c7..a8ad040c4bf5 100644 --- a/tests/acceptance/features/apiProvisioning-v2/addGroup.feature +++ b/tests/acceptance/features/apiProvisioning-v2/addGroup.feature @@ -16,6 +16,7 @@ So that I can more easily manage access to resources by groups rather than indiv | group_id | comment | | new-group | dash | | the.group | dot | + | left,right | comma | | España | special European characters | | नेपाली | Unicode group name | | 0 | The "false" group | diff --git a/tests/acceptance/features/apiProvisioning-v2/addToGroup.feature b/tests/acceptance/features/apiProvisioning-v2/addToGroup.feature index 7abc41e4b8b0..52713c8d3bb5 100644 --- a/tests/acceptance/features/apiProvisioning-v2/addToGroup.feature +++ b/tests/acceptance/features/apiProvisioning-v2/addToGroup.feature @@ -18,6 +18,7 @@ So that I can give a user access to the resources of the group | group_id | comment | | new-group | dash | | the.group | dot | + | left,right | comma | | España | special European characters | | नेपाली | Unicode group name | | 0 | The "false" group | diff --git a/tests/acceptance/features/apiProvisioning-v2/deleteGroup.feature b/tests/acceptance/features/apiProvisioning-v2/deleteGroup.feature index 0656c90a8bf9..aa335709025a 100644 --- a/tests/acceptance/features/apiProvisioning-v2/deleteGroup.feature +++ b/tests/acceptance/features/apiProvisioning-v2/deleteGroup.feature @@ -17,6 +17,7 @@ So that I can remove unnecessary groups | group_id | comment | | new-group | dash | | the.group | dot | + | left,right | comma | | España | special European characters | | नेपाली | Unicode group name | | 0 | The "false" group | diff --git a/tests/acceptance/features/apiProvisioning-v2/removeFromGroup.feature b/tests/acceptance/features/apiProvisioning-v2/removeFromGroup.feature index 9dcaa5da8582..69f0613c174d 100644 --- a/tests/acceptance/features/apiProvisioning-v2/removeFromGroup.feature +++ b/tests/acceptance/features/apiProvisioning-v2/removeFromGroup.feature @@ -20,6 +20,7 @@ So that I can manage user access to group resources | group_id | comment | | new-group | dash | | the.group | dot | + | left,right | comma | | España | special European characters | | नेपाली | Unicode group name | | 0 | The "false" group | diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index 06b701a7f9ae..9099ab56b5d9 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -1637,6 +1637,15 @@ public function dataIsSharingDisabledForUser() { // New list only groups in common $data[] = ['yes', \json_encode(['group1', 'group2']), null, ['group2'], true]; + // New list partly in common, group names containing comma + $data[] = ['yes', \json_encode(['group1,a', 'group2']), null, ['group1,a', 'group3'], true]; + $data[] = ['yes', \json_encode(['group1,a', 'group2,b']), null, ['group1,a', 'group3'], true]; + $data[] = ['yes', \json_encode(['group1,a', 'group2']), null, ['group1,a', 'group3,c'], true]; + + // New list only groups in common, group names containing comma + $data[] = ['yes', \json_encode(['group1', 'group2,a']), null, ['group2,a'], true]; + $data[] = ['yes', \json_encode(['group1,a', 'group2,a']), null, ['group2,a'], true]; + return $data; }