feat: limit access for role manager to assignment details
This commit is contained in:
@@ -46,14 +46,19 @@ class DispositionVoter extends Voter
|
||||
$disposition = $subject;
|
||||
|
||||
return match ($attribute) {
|
||||
static::VIEW, static::EDIT, static::CONTRACT, static::INVOICE => $this->assertAdministrativeAccess($token) || $this->assertTeamerAccess($token, $disposition),
|
||||
static::DELETE => $this->assertAdministrativeAccess($token),
|
||||
static::VIEW, static::EDIT, static::CONTRACT, static::INVOICE => $this->assertAdministrativeAccess() || $this->assertTeamerAccess($token, $disposition),
|
||||
static::DELETE => $this->assertAdminAccess(),
|
||||
static::FEEDBACK => $this->assertHouseManagerAccess($token, $disposition),
|
||||
default => false,
|
||||
};
|
||||
}
|
||||
|
||||
private function assertAdministrativeAccess(TokenInterface $token): bool
|
||||
private function assertAdminAccess(): bool
|
||||
{
|
||||
return $this->security->isGranted('ROLE_ADMIN');
|
||||
}
|
||||
|
||||
private function assertAdministrativeAccess(): bool
|
||||
{
|
||||
return $this->security->isGranted('ROLE_ADMINISTRATIVE');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user