standardization of policies/permissions
linter / quality (push) Failing after 1m3s
tests / ci (8.3) (push) Failing after 48s
tests / ci (8.4) (push) Failing after 1m5s
tests / ci (8.5) (push) Failing after 1m4s

This commit is contained in:
Daan Meijer
2026-06-22 16:13:32 +02:00
parent c60033b365
commit 188c4435cb
11 changed files with 166 additions and 162 deletions
+4 -2
View File
@@ -24,8 +24,9 @@ class MutationPolicy
public function update(User $user, Mutation $mutation): bool
{
$dynamic = $mutation->ledger->dynamic;
$isOwner = $dynamic->participants()->where('user_id', $user->id)->where('role', 'owner')->exists();
return $dynamic->participants()->where('user_id', $user->id)->where('role', 'owner')->exists();
return $isOwner && $mutation->status === 'pending';
}
/**
@@ -34,7 +35,8 @@ class MutationPolicy
public function void(User $user, Mutation $mutation): bool
{
$dynamic = $mutation->ledger->dynamic;
$isOwner = $dynamic->participants()->where('user_id', $user->id)->where('role', 'owner')->exists();
return $dynamic->participants()->where('user_id', $user->id)->where('role', 'owner')->exists();
return $isOwner && $mutation->status !== 'voided';
}
}