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

Adding --as-default to CLI omero user joingroup #5914

Closed

Conversation

kennethgillen
Copy link
Member

Adding a parameter to set a user's default group when joining a new group, and a helper function to set the default group for a user.

Ideally the CLI should also allow an ad-hoc "set group" command on it's own, but I see this as an incremental improvement towards that goal, and it certainly answers the use case I have for adding users to a group and setting that to be the default group in one command.

What this PR does

Allows a CLI user to set the default group of a user when adding the user to a group.

Testing this PR

  1. required setup

Apply the diff in this PR.

  1. actions to perform

Identify a group which your test user does not belong to.

Issue a CLI command with the new --as-default flag like so, with 103 as an example:

omero user joingroup --group-id 103 --as-default

Then issue a further

omero user joingroup --group-id 103
  1. expected observations
    Output like the following should appear, if the user was not already a member of the group.
Set the default group of user 793 to group 153

Then

793 is already in group 103

Related reading

Link to cards, tickets, other PRs: https://trello.com/c/sjEk7VQG/487-cli-manage-group-and-user-missing-features

  1. background for understanding this PR

  2. what this PR assists, fixes, or otherwise affects

The missing ability to set the default group of a user by the CLI.

… and a helper function to set the default group for a user.
@joshmoore
Copy link
Member

Thanks for this, @kennethgillen. I don't know if I will have time to make a commit today but on top of this I would imagine the following:

  • (possibly) use just the first group listed as the default? (as-default becomes set-default)
  • a bin/omero group default [--set] $user [$group] method to get/show the default
  • python tests

@kennethgillen
Copy link
Member Author

kennethgillen commented Nov 22, 2018

Thanks for the initial review. I don't see a need to rush this into the codebase as is - I'll just use my own branch to do the necessary job to fulfil my own need. To some extent this PR is mainly to add a foundation to build upon.

@jburel
Copy link
Member

jburel commented Nov 23, 2018

flake8

./components/tools/OmeroPy/src/omero/cli.py:2270:80: E501 line too long (80 > 79 characters)
./components/tools/OmeroPy/src/omero/cli.py:2271:80: E501 line too long (95 > 79 characters)
./components/tools/OmeroPy/src/omero/plugins/user.py:361:80: E501 line too long (94 > 79 characters)
./components/tools/OmeroPy/src/omero/plugins/user.py:363:80: E501 line too long (91 > 79 characters)
./components/tools/OmeroPy/src/omero/plugins/user.py:367:80: E501 line too long (80 > 79 characters)
./components/tools/OmeroPy/src/omero/plugins/user.py:368:80: E501 line too long (86 > 79 characters)

@joshmoore joshmoore added exclude transfer Migrate to another repository labels Aug 20, 2019
@joshmoore
Copy link
Member

migrated to: ome/omero-py#199

@joshmoore joshmoore closed this Mar 18, 2020
@kennethgillen kennethgillen deleted the set_default_group_cli branch June 23, 2020 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude transfer Migrate to another repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants