/** * Checks if an username exists */ public function existsAction() { $acl = \App::get('acl'); $user = \App::getUserLogged(); if (!$acl->existsPrivilege($user, $user, 'create')) { throw PermissionException("Not allowed to create users"); } $username = $this->getRequest()->getParam('username'); if (empty($username)) { throw new InvalidArgumentException('No username given'); } // Fetch user matching the username $user = $this->_userSrv->loadByUsername($username); $this->view->data = $user !== NULL; }
public function tearDown() { if ($this->_org && $this->_org->getId()) { $this->_org->delete(); } if ($this->_user && $this->_user->getId()) { $this->_user->delete(); } if ($this->_service && $this->_user && $this->_user->getUserName()) { $user = $this->_service->loadByUsername($this->_user->getUserName()); if (!is_null($user)) { $user->delete(); } } }