feat(maasservicelayer): add bulk-remove and bulk-create operations for users and entitlements in groups#163
Open
nehjoshi wants to merge 4 commits intocanonical:masterfrom
Open
feat(maasservicelayer): add bulk-remove and bulk-create operations for users and entitlements in groups#163nehjoshi wants to merge 4 commits intocanonical:masterfrom
nehjoshi wants to merge 4 commits intocanonical:masterfrom
Conversation
…r users and entitlements in groups
db3ac94 to
b107571
Compare
r00ta
reviewed
Apr 20, 2026
r00ta
requested changes
Apr 20, 2026
| async def bulk_delete_entitlements( | ||
| self, | ||
| group_id: int, | ||
| items: list[tuple[str, str, int]], |
Contributor
There was a problem hiding this comment.
In general I discourage to pass list[tuple[str,str,int]]. Use a typed model instead
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added 3 new endpoints:
POST /groups/{group_id}/members:batch_create: For adding multiple users to a group in one operation. Thebatch_createsuffix is appended to separate this endpoint from thePOST /groups/{group_id}/membersfor adding a single member.DELETE /groups/{group_id}/members: For removing multiple users from a group in one operationPOST /groups/{group_id}/entitlements:batch_delete: Removes multiple entitlements from a group in a single operation. Entitlements within a group do not have a uniqueid. Instead, each entitlement is identified by a combination of fields:resource_type,resource_id, andentitlement(e.g.can_edit_machines). Deleting multiple entitlements therefore requires sending a structured payload (e.g. an array of these field combinations).While this could map to a
DELETEendpoint, doing so would require a request body. In practice, request bodies onDELETEare discouraged by MDN (see docs). For this reason,POSTis chosen. Also, the suffixbatch_deleteis appended becausePOST /groups/{group_id}/entitlementsalready exists for entitlement creation.The following endpoints are modified and now include pagination:
GET /groups/{group_id}/membersGET /groups/{group_id}/entitlementsResolves MAASENG-6347