Sharing backend: shares CRUD + ACL enforcement everywhere (#16)
Build image / build-and-push (push) Successful in 4s

Co-authored-by: Steve Dudenhoeffer <[email protected]>
This commit was merged in pull request #35.
This commit is contained in:
2026-07-19 03:49:54 +00:00
committed by steve
parent 48ba08e8f2
commit 2a86f87b50
11 changed files with 733 additions and 24 deletions
+12 -2
View File
@@ -121,9 +121,19 @@ func (s *Service) UpdatePlanting(ctx context.Context, actorID, plantingID int64,
return nil, err
}
originalPlantID := pl.PlantID
applyPlantingPatch(pl, patch)
// The plant may have changed; the (possibly new) plant must be visible.
plant, err := s.visiblePlant(ctx, actorID, pl.PlantID)
// Fetch the plop's plant for the derived count. Only when the actor is
// actually CHANGING the plant (new id ≠ old) is the new plant gated on
// visibility — an existing plop may reference a plant the actor can't see
// (e.g. a shared editor in the owner's garden using the owner's private
// plant), and a no-op plantId resend must not break editing it.
var plant *domain.Plant
if pl.PlantID != originalPlantID {
plant, err = s.visiblePlant(ctx, actorID, pl.PlantID)
} else {
plant, err = s.store.GetPlant(ctx, pl.PlantID)
}
if err != nil {
return nil, err
}