Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI info, listusers and listgroups subcommands #3350

Merged
merged 17 commits into from
Jan 21, 2015

Conversation

sbesson
Copy link
Member

@sbesson sbesson commented Jan 15, 2015

Fixes https://trac.openmicroscopy.org/ome/ticket/12589

This PR adds

  • a info subcommand to both UserControl and GroupControl plugins. These commands have the same behavior as the list subcommand for a subset of users/groups. The following commands should now be accepted

    bin/omero user info   # Give info about the context user
    bin/omero user info user-1
    bin/omero user info user-1 --user-id 3 --user-name user-4
    bin/omero group info   # Give info about the context user
    bin/omero group info read-write1
    bin/omero group info read-write1 --group-id 3 --group-name read-annotate-1
    
  • a bin/omero group listusers and a bin/omero user listgroups subcommands. Both subcommands either take no argument (using the context) or a single argument. The following calls should work:

    bin/omero group listusers   # Return the users of the context group
    bin/omero group listusers read-write1
    bin/omero user listgroups   # Return the groups of the context user
    bin/omero user listgroups user-6
    

To test this PR:

  • check the commands above are working in a multi-user/multi-group context
  • check the integration tests are passing both for the new commands as well as the user list and group list subcommands which were refactored as part of this PR

--no-rebase

This new subcommand should list the members of the current group using the
session context). Most of the arguments and logic of the user list subcommand
are re-used and the common elements are migrated to the ArgumentParser and
UserGroupControl classes
This new subcommand should list the groups of the current users. Most of the
arguments and logic of the group list subcommand are re-used and the common
elements are migrated to the ArgumentParser and UserGroupControl classes.
@@ -23,7 +23,8 @@
from omero.cli import CLI
import pytest

subcommands = ['add', 'list', 'password', 'email', 'joingroup', 'leavegroup']
subcommands = ['add', 'list', 'password', 'email', 'joingroup', 'leavegroup',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if this could be added to the "BaseControl" API? Somehow it should be possibly to figure out what commands are available...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely a sensible idea, will try to work on that in a separate branch.

@sbesson sbesson closed this Jan 15, 2015
@sbesson sbesson reopened this Jan 15, 2015
@joshmoore
Copy link
Member

Various user info points:

  • under info I expected more than just a listing of groups. Perhaps this is really groups, and info could list the likes of LDAP DN, email, institution, etc. Perhaps (later) with an --edit option?
  • The output of users info --long can be fairly hard to use since it is so wide and --style=csv --long isn't parseable (though this problem likely exists currently for other output).
  • eventually having info [username | userid] would make sense.

@joshmoore
Copy link
Member

Some of above also applies to group just swapped. Only other question at this point is why the difference between the defaults of --long and --count?

@sbesson
Copy link
Member Author

sbesson commented Jan 16, 2015

On the last question, one of the relevant PRs was #514. As far as I can tell, the main reason for doing this is that group user with --long would result in a very long line for the user group. If we homogeneize, I would suggest we use --count as the default across the board.

@sbesson
Copy link
Member Author

sbesson commented Jan 17, 2015

Excluding to let #3356 be reviewed. More work coming / PR description will be updated.

@sbesson sbesson changed the title Add CLI group members and user info subcommands Add CLI info, listusers and listgroups subcommands Jan 18, 2015
@sbesson sbesson removed the exclude label Jan 18, 2015
@sbesson
Copy link
Member Author

sbesson commented Jan 18, 2015

PR description/title updated to describe the new subcommands.

@ximenesuk
Copy link
Contributor

I've managed to briefly check out the commands and most of the options. I don't know if there is more to come but I'll take another look tomorrow once the later commits have been tested by the CI system.

@ximenesuk
Copy link
Contributor

This looks fine to me. Everything seems to work as expected. Good to merge.

joshmoore added a commit that referenced this pull request Jan 21, 2015
Add CLI info, listusers and listgroups subcommands
@joshmoore joshmoore merged commit 03ee22d into ome:develop Jan 21, 2015
@sbesson sbesson deleted the 12589_cli_group_members branch January 21, 2015 15:21
@sbesson sbesson added this to the 5.1.0-m4 milestone Feb 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants