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

Use new endpoints for adding/removing users to/from groups #651

Closed
tcompa opened this issue Nov 21, 2024 · 5 comments · Fixed by #655
Closed

Use new endpoints for adding/removing users to/from groups #651

tcompa opened this issue Nov 21, 2024 · 5 comments · Fixed by #655

Comments

@tcompa
Copy link
Collaborator

tcompa commented Nov 21, 2024

(not yet implemented in the backend, I will update this issue when it is)

In the current status:

  • We cannot remove users from a user group
  • Adding users to a user groups is meant to also work for the "bulk" case, even though we only add one user at a time in the current fractal-web UI.

As soon as fractal-analytics-platform/fractal-server#1841 (starting from fractal-analytics-platform/fractal-server#1841 (comment)) is implemented and released, two things will change:

  • The current way of adding users will be deprecated
  • There will be two more atomic endpoints that add/remove a single user and then return the updated group object:
POST /group/{group_id}/add-user/{user_id}/
POST /group/{group_id}/remove-user/{user_id}/

Relevant PR:


Side-note: we are leaving the possibility of bulk user addition/removal for the future, and it may eventually be part of POST /auth/group/{user_group_id}/add-users-bulk/ and POST /auth/group/{user_group_id}/remove-users-bulk/.

@tcompa
Copy link
Collaborator Author

tcompa commented Nov 25, 2024

Now available in fractal-server main (and released as 2.9.0a10 in a few minutes)

The relevant part of the CHANGELOG is

  • Add POST /auth/group/{group_id}/add-user/{user_id}/ (#2101).
  • Add POST /auth/group/{group_id}/remove-user/{user_id}/ (#2101).
  • Remove new_user_ids property from PATCH /auth/group/{group_id}/ (#2101).

@tcompa tcompa changed the title [placeholder] Use new endpoints for adding/removing users to/from groups Use new endpoints for adding/removing users to/from groups Nov 25, 2024
@zonia3000
Copy link
Collaborator

Have you planned to enable this also from the user editing page?

Currently we can only add groups, using the endpoint PATCH /api/auth/users/{user_id}/ with the following payload:

{
  "new_group_ids": [1,3]
}

@tcompa
Copy link
Collaborator Author

tcompa commented Nov 25, 2024

You are right, we will quickly add a new endpoint

POST /users/{user_id}/set-groups/

with a request-body property new_group_ids that fully replaces the existing user/group links with the new ones.

@tcompa
Copy link
Collaborator Author

tcompa commented Nov 26, 2024

You are right, we will quickly add a new endpoint

POST /users/{user_id}/set-groups/

with a request-body property new_group_ids that fully replaces the existing user/group links with the new ones.

Now available in fractal-server 2.9.0a11 (as soon as https://github.com/fractal-analytics-platform/fractal-server/actions/runs/12026803057/job/33526500615 completes).

The request body must have a single property, as in

{
  "group_ids": [1, 2, 3]
}

and its specs are defined here fractal-analytics-platform/fractal-server#2105

@zonia3000
Copy link
Collaborator

It is possible to remove members from the group both by clicking on the X button on the user badges and by dragging them outside the "drag users here" area.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants