openmicroscopy/openmicroscopy — pull request #1051 by sbesson (2013-04-17 09:51:30+00:00)
Title: CLI: Improve group arguments allowing to specify input type (see #10677) (rebased onto develop)

This is the same as gh-1022 but rebased onto develop.

----

In `add`, `joingroup`, `leavegroup` subcommands, group can be passed by id, by name
or by id_or_name as a positional argument.

Tested the `add` subcommand locally with:
```
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero group add 1938
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Added group 1953 (id=1938) with permissions rw----
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero group list
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
id | name | perms | # of owners | # of members
------+--------------------------------------+--------+-------------+--------------
....
1953 | 1938 | rw---- | 0 | 0
(809 rows)
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user add 1942 1942 1942 --group-id 1938
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Unknown group: 1938
No group found
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user add 1942 1942 1942
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
No input group is specified
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user add 1942 1942 1942 --group-name 1938
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Please enter password for your new user (1942):
Please re-enter password for your new user (1942):
Added user 1952 with password
```

and re-tested the join `group/leavegroup` subcommands
```
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user add 1942 1942 1942 --group-name 1938
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user leavegroup --name 1942 --group-id 1938
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Unknown group: 1938
No group found
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user leavegroup --name 1942 --group-name 1938
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Removed 1952 from group 1953
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user joingroup --id 1952
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
No input group is specified
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user joingroup --id 1952 1938
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Unknown group: 1938
No group found
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user joingroup --id 1952 --group-name 1938
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Added 1952 to group 1953
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user joingroup --id 1952 --group-name 1938 --as-owner
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Added 1952 to the owner list of group 1953
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user leavegroup --name 1942 --group-id 1953 --as-owner
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Removed 1952 from the owner list of group 1953
sebastien@jrs-macbookpro-25399:dist (10677_integergroupname) $ bin/omero user leavegroup --name 1942 1953 --as-owner
Using session 9eb9196e-4d17-4a16-a1a2-b8a27940f07a (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
1952 is not owner of group 1953
```