protected function getCurrentAdministration() { $user = $this->getUser(); if (!$user) { return false; } return $this->administrationManager->getCurrentAdministration($user); }
/** * @param $slug * @param string $requiredPermission * @return Administration|null * @throws EntityNotFoundException * @throws AccessDeniedException */ public function getAdministrationBySlugWithAccess($slug, User $user, $requiredPermission = Permission::EDIT) { $administration = $this->manager->getAdministrationBySlug($slug); if (!$this->hasAccess($user, $administration, $requiredPermission)) { throw new AccessDeniedException(); } return $administration; }
public function countUnprocessedTransactions(User $user) { $administration = $this->administrationManager->getCurrentAdministration($user); $transactions = $this->transactionManager->getUnProcessedTransactions($administration); return count($transactions); }