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

user: allow setting default group #199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joshmoore
Copy link
Member

@joshmoore joshmoore commented Mar 18, 2020

migrate code from openmicroscopy and fix flake8

see: ome/openmicroscopy@8442eed
https://forum.image.sc/t/set-user-default-group-from-command-line/35171


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.

migrate code from openmicroscopy and fix flake8

see:
ome/openmicroscopy@8442eed
@joshmoore
Copy link
Member Author

Some thoughts of mine from: ome/openmicroscopy#5914 (comment)


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

@joshmoore
Copy link
Member Author

Reopening with pytest fix

@joshmoore joshmoore closed this Apr 3, 2020
@joshmoore joshmoore reopened this Apr 3, 2020
@sbesson sbesson added this to the 5.12.0 milestone May 24, 2022
@will-moore
Copy link
Member

Clearly (as mentioned) it would be useful to set the default group to a group that the user is already a member of. This would allow a regular user to set their own default group, without having to be an Admin, which is required by omero user joingroup
However, this otherwise works as described, so 👍

@joshmoore
Copy link
Member Author

👍 also happy to take PRs and/or suggestions on which of the API improvements to use.

@will-moore
Copy link
Member

Looking for PRs that could go in a release soon. I this "done" for now?

@joshmoore
Copy link
Member Author

Tests are missing and there's no final word on what we want the API to be. Feel free to go ahead without it.

@sbesson sbesson removed this from the 5.12.0 milestone Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants