This commit is contained in:
2026-11-03 11:51:44 +02:00
parent badaada043
commit e753f7a0a4
309 changed files with 14537 additions and 529 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Services;
use App\Models\Supplier;
use App\Models\User;
/** Shared eligibility; review commands still validate the current version and activation facts. */
class SupplierParticipation
{
public function canPrepare(User $actor): bool
{
return $actor->tenant_id !== null && $actor->hasFunctions(['procurement']) && ! app(OrganizationAccess::class)->maintenanceOnly($actor);
}
public function canReviewRole(User $actor): bool
{
return $actor->tenant_id !== null && $actor->hasFunctions(['finance']) && ! app(OrganizationAccess::class)->maintenanceOnly($actor);
}
public function canReview(User $actor, Supplier $supplier): bool
{
return $actor->tenant_id === $supplier->tenant_id && $this->canReviewRole($actor)
&& $actor->id !== $supplier->created_by && $actor->id !== $supplier->last_changed_by;
}
}