feat: enable document uploads for admins on behalf of teamer
closes #869btf5bm
This commit is contained in:
@@ -16,6 +16,7 @@ class DispositionVoter extends Voter
|
||||
public const DELETE = 'DELETE';
|
||||
public const CONTRACT = 'CONTRACT';
|
||||
public const CONTRACT_SUPPLEMENTARY = 'CONTRACT_SUPPLEMENTARY';
|
||||
public const ADMIN_DOCUMENT_UPLOAD = 'ADMIN_DOCUMENT_UPLOAD';
|
||||
public const INVOICE = 'INVOICE';
|
||||
public const FEEDBACK = 'FEEDBACK';
|
||||
public const CALL_OFF = 'CALL_OFF';
|
||||
@@ -36,6 +37,7 @@ class DispositionVoter extends Voter
|
||||
static::DELETE,
|
||||
static::CONTRACT,
|
||||
static::CONTRACT_SUPPLEMENTARY,
|
||||
static::ADMIN_DOCUMENT_UPLOAD,
|
||||
static::INVOICE,
|
||||
static::FEEDBACK,
|
||||
static::CALL_OFF,
|
||||
@@ -54,6 +56,7 @@ class DispositionVoter extends Voter
|
||||
static::FEEDBACK => $this->security->isGranted('ROLE_ADMINISTRATIVE')
|
||||
|| $this->assertHouseManagerAccess($token, $disposition),
|
||||
static::CONTRACT_SUPPLEMENTARY => $this->assertContractUploadAllowed($disposition),
|
||||
static::ADMIN_DOCUMENT_UPLOAD => $this->assertAdminDocumentUploadAllowed($disposition),
|
||||
static::CALL_OFF => $this->security->isGranted('ROLE_ADMINISTRATIVE')
|
||||
&& Disposition::STATUS_CALLED_OFF !== $disposition->getStatus(),
|
||||
default => false,
|
||||
@@ -110,4 +113,14 @@ class DispositionVoter extends Voter
|
||||
|
||||
return null === $existingContract || Upload::STATUS_REJECTED === $existingContract->getStatus();
|
||||
}
|
||||
|
||||
private function assertAdminDocumentUploadAllowed(Disposition $disposition): bool
|
||||
{
|
||||
if (false === $this->security->isGranted('ROLE_ADMINISTRATIVE')
|
||||
&& false === $this->security->isGranted('ROLE_ADMIN')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Disposition::STATUS_CALLED_OFF !== $disposition->getStatus();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user