commit21
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user