privilegeService = $privilegeService; $this->userService = $userService; $this->searchParser = new SearchParser($searchParserConfig); $this->userViewProxy = $userViewProxy; } public function getMethods() { return ['GET']; } public function getUrl() { return '/api/users/:userNameOrEmail'; } public function work($args) { $userNameOrEmail = $args['userNameOrEmail']; if (!$this->privilegeService->isLoggedIn($userNameOrEmail)) $this->privilegeService->assertPrivilege(Privilege::VIEW_USERS); $user = $this->userService->getByNameOrEmail($userNameOrEmail); return ['user' => $this->userViewProxy->fromEntity($user)]; } }