occ commands to list users and groups#28312
Conversation
Signed-off-by: Phil Davis <phil@jankaritech.com>
|
I don't see where there are existing "acceptance tests" that run various occ command line commands and check that the required actions or output actually happened. Because it would be good to know that occ commands do what they claim, both existing ones and these new ones. |
|
@phil-davis there are no tests for occ commands currently. There is this PR https://github.com/owncloud/automated-tests/pull/17 @PVince81 a couple of questions:
|
|
Good to know. I would think that occ command tests should be quite easy to add to the integration tests and have behat scenarios. Just needs to go in the backlog of acceptance/integration tests to be written. |
|
@phil-davis |
|
Doc issue owncloud-archive/documentation#3203 which I will follow up once people have had a chance to review and comment on this PR. |
|
Feel free to call in anyone else who should give review or feedback on expanding the occ command. |
|
|
||
| use OC\Core\Command\Base; | ||
| use OCP\IGroupManager; | ||
| use Symfony\Component\Console\Command\Command; |
| use OCP\IGroupManager; | ||
| use Symfony\Component\Console\Command\Command; | ||
| use Symfony\Component\Console\Input\InputInterface; | ||
| use Symfony\Component\Console\Input\InputOption; |
| parent::configure(); | ||
|
|
||
| $this | ||
| ->setName('group:listmembers') |
There was a problem hiding this comment.
list-members
please adjust this naming convention to all group commands - THX
There was a problem hiding this comment.
The following existing occ commands do not have the "-":
app:getpath
user:lastseen
user:resetpassword
I guess these should not be changed, as that would break backward-compatibility if users have scripted/depend on them.
The following are new commands awaiting release in 10.0.3, so I can change those easily as there are no users depending on them yet:
group:addmember
group:removemember
see #28318
And I will fix the new commands introduced here.
There was a problem hiding this comment.
yes - please fix all the new ones - and yes - we failed to name those old ones 😠
anyway - THX
| $groupName = $input->getArgument('group'); | ||
| $group = $this->groupManager->get($groupName); | ||
| if (!$group) { | ||
| $output->writeln('<error>Group "' . $groupName . '" does not exist</error>'); |
There was a problem hiding this comment.
I prefer interpolated strings fro better readability
$output->writeln("<error>Group $groupName does not exist</error>");There was a problem hiding this comment.
I copy-pasted this style from other code in these core/Command/... files.
Do I update everywhere so the code will look consistent?
There was a problem hiding this comment.
generally speaking I prefer to enhance/change code only if there is a need.
changing code 'just because of making it nice' is not the way to go.
thx
Signed-off-by: Phil Davis <phil@jankaritech.com>
|
| ->setName('group:list') | ||
| ->setDescription('list groups') | ||
| ->addArgument( | ||
| 'group', |
There was a problem hiding this comment.
search pattern or something would match better I guess
There was a problem hiding this comment.
Yes, I had 'pattern' in there at one stage yesterday.
If I make it 'searchpattern' do I write it:
'searchpattern' or
'search-pattern' or
'searchPattern'?
(and will do the same style of thing for ListUsers.php)
There was a problem hiding this comment.
same naming schema search-pattern - THX
Signed-off-by: Phil Davis <phil@jankaritech.com>
|
@DeepDiver1975 IMHO this is good to go |
* occ commands to list users and groups Signed-off-by: Phil Davis <phil@jankaritech.com> * Add hyphens to list-members and list-groups occ group commands Signed-off-by: Phil Davis <phil@jankaritech.com> * Use search-pattern as arg in group:list and user:list Signed-off-by: Phil Davis <phil@jankaritech.com>
|
👍 thanks a lot |
|
Doc issue owncloud-archive/documentation#3203 already raised, so it won;t get lost. |
* occ commands to list users and groups Signed-off-by: Phil Davis <phil@jankaritech.com> * Add hyphens to list-members and list-groups occ group commands Signed-off-by: Phil Davis <phil@jankaritech.com> * Use search-pattern as arg in group:list and user:list Signed-off-by: Phil Davis <phil@jankaritech.com>
implemented in PR owncloud/core#28312 resolves doc issue #3203
implemented in PR owncloud/core#28312 resolves doc issue #3203
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Provide the following new items for the occ command:
Related Issue
#28311
Motivation and Context
Help with managing users and groups from the occ command line.
How Has This Been Tested?
Running the occ commands on a test system with various filters, no filtering, with non-existent user and group names.
Types of changes
Checklist: