6e5e5c08bf
- Add can_delete column to document_shares (migration 0005) - Inject x-user-is-admin header from backend proxy to doc-service - Add get_user_is_admin() dep in doc-service - Delete endpoint now allows: owner, admin, or group member with can_delete=true - Watch documents (user_id='watch') deletable by admins only - DocumentOut gains viewer_can_delete (computed per-request) - Share UI: 'Allow group members to delete' checkbox + trash badge on shares - RowActionsMenu dropdown portaled to document.body — fixes overflow-hidden clipping - Delete mutation onError handler — no more silent failures Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
2026-04-18 — Document delete permissions + three-dots menu fix
Timestamp: 2026-04-18T00:00:00Z
Summary
Added a proper permission model for document deletion: owners and admins can always delete; group members can delete only when the share was explicitly granted can_delete=true. Fixed silent delete failures (watch docs returning 404 with no user feedback) and fixed the three-dots context menu being clipped by overflow-hidden on the table container.
Files Added / Modified / Deleted
Added
features/doc-service/alembic/versions/0005_add_share_can_delete.py— migration: addscan_delete BOOLEAN NOT NULL DEFAULT falsetodocument_shares
Modified
features/doc-service/app/models/document_share.py— addedcan_delete: Mapped[bool]columnfeatures/doc-service/app/schemas/share.py— addedcan_deletetoDocumentShareOutandDocumentShareCreate; addedviewer_can_deletetoSharedDocumentOutfeatures/doc-service/app/schemas/document.py— addedviewer_can_delete: bool = FalsetoDocumentOutfeatures/doc-service/app/deps.py— addedget_user_is_admin()dep readingx-user-is-adminheaderfeatures/doc-service/app/routers/documents.py— added_get_deletable_doc_ids()helper; updated list/get/delete endpoints with permission logic; updatedadd_shareto storecan_delete; updated shared-with-me to includeviewer_can_deletebackend/app/routers/documents_proxy.py—_forward_headers()now injectsx-user-is-adminheaderfrontend/src/api/client.ts—DocumentOut: addedviewer_can_delete;DocumentShareOut: addedcan_delete;addDocumentShare: acceptscanDeleteparamfrontend/src/pages/DocumentsPage.tsx—RowActionsMenu: replaced absolute dropdown withcreatePortalto fix clipping; delete button now usesdoc.viewer_can_delete; addedonErrorhandler for silent failuresfrontend/src/components/DocumentSlideOver.tsx— sharing section: shows trash icon badge on shares withcan_delete=true; added "Allow group members to delete" checkbox before group picker; delete button usesdoc.viewer_can_deletefeatures/doc-service/CLAUDE.md— updateddocument_sharestable docs + migration chainbackend/CLAUDE.md— notedx-user-is-adminheader injection