isUserLoggedIn() && $subject->getOrganization()->count() === 1 && $this->security->isGranted($role) && $subject->getOrganization()->current()->getId() === $this->getUser()->getOrganization()->getId(); } /** * @inheritdoc * * @param $subject BankAccount * @return boolean */ protected function canView(object $subject): bool { return $this->canInteractIfHasRole($subject, 'ROLE_ORGANIZATION_VIEW'); } /** * @inheritdoc * * @param $subject BankAccount * @return boolean */ protected function canEdit(object $subject): bool { return $this->canInteractIfHasRole($subject, 'ROLE_ORGANIZATION'); } /** * @inheritdoc * * @param $subject BankAccount * @return boolean */ protected function canDelete(object $subject): bool { return $this->canEdit($subject); } }