Move cascading and validation logic out of the API route into the
Document model for safety, ensuring invariants are enforced regardless
of how isPrivate is changed.
- Add @BeforeUpdate hook to prevent unrestricting a child of a
restricted parent
- Add cascadeRestrict() and cascadeUnrestrict() instance methods
for descendant propagation and membership cleanup/rebuild
- Slim down API route to only handle authorization and acting-user
admin membership
- Update documentMover to use cascadeRestrict(), fixing a gap where
sourced memberships weren't destroyed on auto-restrict during move
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>