/** * @param $login * @param bool $notifyUser * @return string * @throws InvalidArgumentException */ public function requestPasswordResetTokenByLogin($login, $notifyUser = true) { $user = $this->userRepository->findByLogin($login); if (!$user) { throw new InvalidArgumentException('phraseanet::erreur: Le compte n\'a pas ete trouve'); } return $this->requestPasswordResetTokenByUser($user, $notifyUser); }
/** * @param $authorizedCollections * @param $user * @return mixed * @throws \Exception */ private function applyAclsToUser(array $authorizedCollections, User $user) { $acl = $this->aclProvider->get($user); if ($this->configuration->get(['registry', 'registration', 'auto-register-enabled'])) { $template_user = $this->userRepository->findByLogin(User::USER_AUTOREGISTER); $acl->apply_model($template_user, array_keys($authorizedCollections)); } }
/** * @param string $login * @return User */ private function getUserOrCurrentUser($login = null) { if ($login !== null) { $user = $this->userRepository->findByLogin($login); if (!$user) { throw new AccountException('User not found'); } } else { $user = $this->authenticationService->getUser(); } return $user; }