feat: call off single disposition as admin with optional notification
This commit is contained in:
@@ -18,6 +18,7 @@ class DispositionVoter extends Voter
|
||||
public const CONTRACT_SUPPLEMENTARY = 'CONTRACT_SUPPLEMENTARY';
|
||||
public const INVOICE = 'INVOICE';
|
||||
public const FEEDBACK = 'FEEDBACK';
|
||||
public const CALL_OFF = 'CALL_OFF';
|
||||
|
||||
public function __construct(private readonly Security $security)
|
||||
{
|
||||
@@ -37,6 +38,7 @@ class DispositionVoter extends Voter
|
||||
static::CONTRACT_SUPPLEMENTARY,
|
||||
static::INVOICE,
|
||||
static::FEEDBACK,
|
||||
static::CALL_OFF,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -53,6 +55,8 @@ class DispositionVoter extends Voter
|
||||
static::FEEDBACK => $this->security->isGranted('ROLE_ADMINISTRATIVE')
|
||||
|| $this->assertHouseManagerAccess($token, $disposition),
|
||||
static::CONTRACT_SUPPLEMENTARY => $this->assertContractUploadAllowed($disposition),
|
||||
static::CALL_OFF => $this->security->isGranted('ROLE_ADMINISTRATIVE')
|
||||
&& Disposition::STATUS_CALLED_OFF !== $disposition->getStatus(),
|
||||
default => false,
|
||||
};
|
||||
}
|
||||
@@ -63,6 +67,10 @@ class DispositionVoter extends Voter
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Disposition::STATUS_CALLED_OFF === $disposition->getStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var User $user */
|
||||
$user = $token->getUser();
|
||||
|
||||
@@ -95,6 +103,10 @@ class DispositionVoter extends Voter
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Disposition::STATUS_CALLED_OFF === $disposition->getStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return null === $disposition->getDocumentByType(Upload::TYPE_CONTRACT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user