✨ Batch share an item from an imported contacts file#784
Open
NathanVss wants to merge 4 commits into
Open
Conversation
The descendants access synchronization logic was private to the accesses viewset. Extracting it into core/services/accesses.py lets the upcoming batch share endpoint reuse it without reaching into viewset internals.
Sharing a folder with many contacts one call at a time is slow and can leave a partial state when one of them fails. This endpoint accepts a list of email/role rows, validates them all before any write, then creates accesses for known users and invitations for unknown emails. Rows targeting users already covered by an equal or higher role are skipped and reported so the client can inform the user. The feature is disabled by default and gated by the new ALLOW_SHARE_IMPORT_FILE setting exposed in the config endpoint.
Plug the ui-kit share modal file import onto the new batch share endpoint. The option only shows up when ALLOW_SHARE_IMPORT_FILE is enabled in the config. Errors are rendered inside the import modal instead of the global toast so the user can fix the file and retry without losing context. The e2e environment enables the flag to cover the flow end to end.
The share import modal needs ui-kit changes and cunningham 4.4.0 that are not published yet, so the ui-kit dependency points to a local checkout for now. To be replaced by a released version before merge.
NathanVss
force-pushed
the
feat/import-users-share
branch
from
July 23, 2026 15:02
7131990 to
0c7aeb1
Compare
|
NathanVss
marked this pull request as ready for review
July 23, 2026 15:04
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.



Purpose
Sharing an item with a large group means inviting people one by one.
This lets administrators and owners import a CSV or XLSX contacts file
(email, role) from the share modal to batch share an item. The feature
is opt-in per environment through a new
ALLOW_SHARE_IMPORT_FILEsetting.
CleanShot.2026-07-20.at.17.22.18.mp4
Proposal
ALLOW_SHARE_IMPORT_FILEsetting (default off), exposed bythe config endpoint so the frontend shows or hides the import entry,
and enforced server side by the new route
POST /api/v1.0/items/<item_id>/batch-share/: every row isvalidated before any database write (a user cannot grant a role higher
than their own); emails are resolved server side — registered users
get an access, unknown emails an invitation; already shared or invited
contacts are skipped and reported in the response; notification emails
behave like single sharing
core/services/accesses.pyentry, async import that closes the modal on success and renders the
backend error inside the import modal on failure
(hidden entry, successful import, failed import)
Notes
@gouvfr-lasuite/ui-kitrelease ships the shareimport modal:
package.jsonmust be bumped from 0.26.0 before review(the branch was developed against a local ui-kit checkout).
env.d/development/common.e2e) enablesthe flag so the success scenario exercises the real endpoint.