Skip to content

Feature Request: File Sharing Across Multiple Groups and Users #281

Open
@paullizer

Description

@paullizer

Summary

Enable sharing of a file across multiple groups (for group documents) and with individual users (for user documents) by introducing new metadata fields in Cosmos and the AI Search index. File sharing should be a feature that can be enabled or disabled from the admin page. This will allow a file to be accessible to users in different groups or to specific users, while maintaining the original group’s or user’s ownership and permissions.


Background

Currently, files are associated with a single group or user, limiting their accessibility. Paul and Alex discussed the need for a mechanism to share files across multiple groups and with individual users, which would improve collaboration and reduce duplication. Administrators should have the ability to enable or disable this feature as needed.


Proposed Solution

1. Schema Update

  • Cosmos Metadata Tags for Group Documents:
    Add a new field to group document metadata:

    "shared_group_ids": ["<group-id-2>", "<group-id-3>"]
    • "group_id" remains the owner; "shared_group_ids" lists additional groups with access.
  • Cosmos Metadata Tags for User Documents:
    Add a new field to user document metadata:

    "shared_user_ids": ["<user-id-2>", "<user-id-3>"]
    • "user_id" remains the owner; "shared_user_ids" lists additional users with access.
  • Cosmos Metadata Tags for Groups:
    Add a shared_group_ids field to group documents to support group-to-group sharing relationships.

2. AI Search Index Update

  • Update the AI Search index definitions for both user and group documents to include the new sharing fields:
    • For group documents: add shared_group_ids
    • For user documents: add shared_user_ids
  • Ensure these fields are indexed and filterable to support search and access control logic.

3. Backend Logic

4. UI/UX

  • Update the frontend to allow selection of multiple groups (for group documents) or users (for user documents) to share a document with at upload or via a sharing dialog.
  • Add a toggle in the admin settings page to enable or disable file sharing. When disabled, hide or disable all sharing-related UI and API endpoints.

Benefits

  • Facilitates collaboration between groups and users without duplicating files.
  • Maintains clear ownership and audit trails.
  • Reduces storage and management overhead.
  • Provides administrators with control over the availability of file sharing.

Example Use Cases

  • A document uploaded by Group A can be shared with Groups B and C. Members of B and C can view (and possibly comment on) the file, but only Group A can modify or delete it unless permissions are extended.
  • A document uploaded by User X can be shared with Users Y and Z. Y and Z can view (and possibly comment on) the file, but only User X can modify or delete it unless permissions are extended.

Example Cosmos Group Document

{
  "id": "<document-id>",
  "file_name": "NanoPZ.pdf",
  "group_id": "<owner-group-id>",
  "shared_group_ids": ["<group-id-2>", "<group-id-3>"],
  ...
}

Example Cosmos User Document

{
  "id": "<document-id>",
  "file_name": "NanoPZ.pdf",
  "user_id": "<owner-user-id>",
  "shared_user_ids": ["<user-id-2>", "<user-id-3>"],
  ...
}

Example Cosmos Group

{
  "id": "<group-id>",
  "name": "Group A",
  "shared_group_ids": ["<group-id-2>", "<group-id-3>"],
  ...
}

Current Implementation


Affected Code


Tasks

  • Update Cosmos DB schema and migration for shared_group_ids in group documents and groups, and shared_user_ids in user documents.
  • Update AI Search index definitions for group and user documents to include the new sharing fields.
  • Update backend endpoints to support multi-group and user access and sharing logic.
  • Update permission checks to distinguish between owner, shared groups, and shared users.
  • Add a feature toggle (enable_file_sharing) in admin settings and ensure all sharing logic respects this setting.
  • Update frontend for multi-group and user sharing, and for the admin toggle.
  • Add tests for new sharing and access logic.
  • Update documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions