feat: provide feedback as admin user
This commit is contained in:
@@ -43,9 +43,10 @@ class DispositionVoter extends Voter
|
||||
$disposition = $subject;
|
||||
|
||||
return match ($attribute) {
|
||||
static::VIEW, static::EDIT, static::CONTRACT, static::INVOICE => $this->assertAdministrativeAccess() || $this->assertTeamerAccess($disposition),
|
||||
static::VIEW, static::EDIT, static::CONTRACT, static::INVOICE => $this->assertAdministrativeAccess()
|
||||
|| $this->assertTeamerAccess($token, $disposition),
|
||||
static::DELETE => $this->assertAdminAccess(),
|
||||
static::FEEDBACK => $this->assertHouseManagerAccess($token, $disposition),
|
||||
static::FEEDBACK => $this->assertAdminAccess() || $this->assertHouseManagerAccess($token, $disposition),
|
||||
default => false,
|
||||
};
|
||||
}
|
||||
@@ -80,12 +81,15 @@ class DispositionVoter extends Voter
|
||||
return $isMatchingHotel && $isPast;
|
||||
}
|
||||
|
||||
private function assertTeamerAccess(Disposition $disposition): bool
|
||||
private function assertTeamerAccess(TokenInterface $token, Disposition $disposition): bool
|
||||
{
|
||||
if (false === $this->security->isGranted('ROLE_TEAMER')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->security->getUser()->getTeamer() === $disposition->getTeamer();
|
||||
/** @var User $user */
|
||||
$user = $token->getUser();
|
||||
|
||||
return $user->getTeamer() === $disposition->getTeamer();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user