standardization of policies/permissions
This commit is contained in:
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user