fix: correct access check to provide feedback
This commit is contained in:
@@ -43,24 +43,16 @@ class DispositionVoter extends Voter
|
|||||||
$disposition = $subject;
|
$disposition = $subject;
|
||||||
|
|
||||||
return match ($attribute) {
|
return match ($attribute) {
|
||||||
static::VIEW, static::EDIT, static::CONTRACT, static::INVOICE => $this->assertAdministrativeAccess()
|
static::VIEW, static::EDIT, static::CONTRACT, static::INVOICE =>
|
||||||
|
$this->security->isGranted('ROLE_ADMINISTRATIVE')
|
||||||
|| $this->assertTeamerAccess($token, $disposition),
|
|| $this->assertTeamerAccess($token, $disposition),
|
||||||
static::DELETE => $this->assertAdminAccess(),
|
static::DELETE => $this->security->isGranted('ROLE_ADMIN'),
|
||||||
static::FEEDBACK => $this->assertAdminAccess() || $this->assertHouseManagerAccess($token, $disposition),
|
static::FEEDBACK => $this->security->isGranted('ROLE_ADMINISTRATIVE')
|
||||||
|
|| $this->assertHouseManagerAccess($token, $disposition),
|
||||||
default => false,
|
default => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private function assertAdminAccess(): bool
|
|
||||||
{
|
|
||||||
return $this->security->isGranted('ROLE_ADMIN');
|
|
||||||
}
|
|
||||||
|
|
||||||
private function assertAdministrativeAccess(): bool
|
|
||||||
{
|
|
||||||
return $this->security->isGranted('ROLE_ADMINISTRATIVE');
|
|
||||||
}
|
|
||||||
|
|
||||||
private function assertHouseManagerAccess(TokenInterface $token, Disposition $disposition): bool
|
private function assertHouseManagerAccess(TokenInterface $token, Disposition $disposition): bool
|
||||||
{
|
{
|
||||||
if (false === $this->security->isGranted('ROLE_HOUSE_MANAGER')) {
|
if (false === $this->security->isGranted('ROLE_HOUSE_MANAGER')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user