user: allow setting default group#199
Conversation
migrate code from openmicroscopy and fix flake8 see: ome/openmicroscopy@8442eed
|
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:
|
|
Reopening with pytest fix |
|
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 |
|
👍 also happy to take PRs and/or suggestions on which of the API improvements to use. |
|
Looking for PRs that could go in a release soon. I this "done" for now? |
|
Tests are missing and there's no final word on what we want the API to be. Feel free to go ahead without it. |
|
Trying to review historical PRs in preparation of the next OMERO.py 5.20.0 milestone, what is the consensus here @will-moore @joshmoore. From the last comments, it looks like the new option in |
|
Wow, the original code is from 2018! |
|
No rush from my side, though during TiM @Tom-TBT and I probably would have used this. 😄 |
|
I would propose we either assign a reviewer or close (and reopen when it's ready for review) |
|
@Tom-TBT, are you up for giving it a try? |
|
Some tests I've done Normal account already in groups
From a normal user perspective, this command is not useful: "I can't set my default group." Same thing from an admin account (still on the
Beside the bug I found, I also feel that not being able to change the default group when a user is already in the group is limiting. But it's also logical given that the name of the command is I see two options:
|
|
@Tom-TBT Are you taking ownership of this PR following your latest review? |
…ys sets it as new default group
|
Discussed today during the PR review meeting. |
Fix for review suggestions ome#199
|
Sorry. I had overlooked Tom's joshmoore#15 I've now merged it and included the mainline. Let's see how the tests do. |
|
lgtm but I've done the fix. Here's how I tested it State before running the command below:
The command ensures that only one group is provided when using
Admin can add user to a group and set it as new default:
Normal users can change their default group:
|
|
$ omero user joingroup --name hok --group-name Demo --as-default digging into the source code in our server Line 103 in our server installation is different from the GitHub version I have also install a fresh version via However, I can get that to work by git cloning and installing the development version. Instead of git cloning it and building the development, any idea why the usual route of pip install doesn't work? |
|
Hi @DrKenHo-crick - this PR was merged on April 22nd 2026 but there hasn't been a release since then. The last release was on March 25th: https://github.com/ome/omero-py/releases/tag/v5.22.1 I don't know if the next milestone / release has been decided yet. |
|
Thanks @will-moore. Sorry about that. I thought it was merged and released. I didn't realised that it was not released yet. It is all fine then. I clone the development one and got it to work. Great jobs. |
|
@DrKenHo-crick this was discussed today as part of the monthly OMERO review call and the agreement was to included this and #495 (once reviewed and merged) in the next minor release of OMERO.py |
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
Apply the diff in this PR.
Identify a group which your test user does not belong to.
Issue a CLI command with the new
--as-defaultflag like so, with 103 as an example:Then issue a further
Output like the following should appear, if the user was not already a member of the group.
Then
Related reading
Link to cards, tickets, other PRs: https://trello.com/c/sjEk7VQG/487-cli-manage-group-and-user-missing-features
background for understanding this PR
what this PR assists, fixes, or otherwise affects
The missing ability to set the default group of a user by the CLI.