docs(sharing): say that owner-only edits cover the shared object, not its contents

The old wording ("sharing grants read access only") read as if a shared
account's transactions were read-only, which keeps producing BOLA reports
against intended behaviour.
This commit is contained in:
Herculino Trotta committed 2026-11-20 20:17:04 -03:00
1 parent f558d52ac6
commit c5662708e4
3 files changed
+12 -6

No files matched your search

+4 -2
View File
@@ -18,8 +18,10 @@ class SharedObjectPermission(BasePermission):
"""Object-level ownership check for SharedObject-backed viewsets.
The viewset's queryset includes other people's public and shared-with-them
objects. Sharing grants read access only, so writes are restricted to the
owner here, as the web UI does with ``get_shared_object_or_error``.
objects. Writes to the shared object itself are restricted to its owner
here, as the web UI does with ``get_shared_object_or_error``. Records inside
a shared or public account (transactions and the like) are not governed by
this check.
Set ``shared_object_via`` on the viewset when the governing SharedObject is
reached through a relation (e.g. ``"strategy"`` for a DCA entry).
+3 -1
View File
@@ -20,7 +20,9 @@ def get_shared_object_or_error(klass, request, *, level=EDIT, via=None, **kwargs
The object must be visible to the user. Denial raises :class:`Http404`
so the response does not confirm that the id exists.
``EDIT``
The object must be owned by the user. Denial raises
The object must be owned by the user. Use this for changes to the
shared object itself, not for records inside it (a shared account's
transactions are writable by everyone who can see it). Denial raises
:class:`~django.core.exceptions.PermissionDenied` (HTTP 403), which the
frontend surfaces as an "Access Denied" dialog. An object the user
cannot even see raises :class:`Http404` instead, so 403 never confirms
+5 -3
View File
@@ -79,9 +79,11 @@ class SharedObject(models.Model):
def is_editable_by(self, user):
"""Whether ``user`` may mutate this object.
Sharing grants read access only; mutation stays with the owner. Objects
with no owner remain editable by everyone, preserving the behaviour of
legacy/unowned objects.
Only the owner may edit, re-share or delete the object itself. This does
not cover what lives inside it: anyone who can see a shared or public
account may change its transactions, by design. Objects with no owner
remain editable by everyone, preserving the behaviour of legacy/unowned
objects.
"""
if self.owner is None:
return True