mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-12-23 22:58:17 -05:00
fix(adventure): enhance collection ownership validation in AdventureSerializer (#723)
This commit is contained in:
@@ -128,7 +128,7 @@ class AdventureSerializer(CustomModelSerializer):
|
||||
|
||||
user = self.context['request'].user
|
||||
for collection in collections:
|
||||
if collection.user_id != user:
|
||||
if collection.user_id != user and not collection.shared_with.filter(id=user.id).exists():
|
||||
raise serializers.ValidationError(
|
||||
f"Collection '{collection.name}' does not belong to the current user."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user