openmicroscopy/openmicroscopy — pull request #1088 by sbesson (2013-04-24 08:22:42+00:00)
Title: CLI: Improve user arguments allowing to specify input type (rebased onto develop)

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

----

This PR adds similar functionalities as in #1022 to the CLI group subcommands, namely:
- allows `group adduser` & `group removeuser` to explicitly look for user by id or name with `--user-id` and `--user-name`
- improves `find_user()` to detect ambiguities (conflict in user ID/name) and return None

Should be tested with users having the same ID and name, e.g.
```
sebastien@jrs-macbookpro-25399:openmicroscopy (cli_finduser) $ dist/bin/omero group removeuser --id 2069 --user-id 2019
Using session 1d0ef373-748f-4fc0-a5a7-d17611d6290d (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Removed 2019 from group 2069
sebastien@jrs-macbookpro-25399:openmicroscopy (cli_finduser) $ dist/bin/omero group adduser --id 2069 2019
Using session 1d0ef373-748f-4fc0-a5a7-d17611d6290d (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Ambiguous user identifier: 2019
No user found
sebastien@jrs-macbookpro-25399:openmicroscopy (cli_finduser) $ dist/bin/omero group adduser --id 2069 --user-name 2019
Using session 1d0ef373-748f-4fc0-a5a7-d17611d6290d (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
2052 is already in group 2069
sebastien@jrs-macbookpro-25399:openmicroscopy (cli_finduser) $ dist/bin/omero group adduser --id 2069 --user-id 2019
Using session 1d0ef373-748f-4fc0-a5a7-d17611d6290d (root@howe.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-only
Added 2019 to group 2069
```