addUser() public method

A user is defined by - a login that has to be unique and valid - a password that has to be valid - an alias - an email that has to be in a correct format
See also: userExists()
See also: isValidLoginString()
See also: isValidPasswordString()
See also: isValidEmailString()
public addUser ( $userLogin, $password, $email, $alias = false, $_isPasswordHashed = false )
示例#1
0
 public function setUp()
 {
     parent::setUp();
     $this->api = API::getInstance();
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
     Fixture::createWebsite('2014-01-01 00:00:00');
     Fixture::createWebsite('2014-01-01 00:00:00');
     Fixture::createWebsite('2014-01-01 00:00:00');
     $this->api->addUser('userLogin', 'password', '*****@*****.**');
 }
 public function testGetUserByEmail()
 {
     $user = array('login' => "login", 'password' => "geqgeagae", 'email' => "*****@*****.**", 'alias' => "alias");
     $this->api->addUser($user['login'], $user['password'], $user['email'], $user['alias']);
     $userByMail = $this->api->getUserByEmail($user['email']);
     $this->assertEquals($user['login'], $userByMail['login']);
     $this->assertEquals($user['email'], $userByMail['email']);
     $this->assertEquals($user['alias'], $userByMail['alias']);
 }
示例#3
0
 public function test_getSitesAccessFromUser_forSuperUser()
 {
     $user2 = 'userLogin2';
     $this->api->addUser($user2, 'password', '*****@*****.**');
     // new user doesn't have access to anything
     $access = $this->api->getSitesAccessFromUser($user2);
     $this->assertEmpty($access);
     $this->api->setSuperUserAccess($user2, true);
     // super user has admin access for every site
     $access = $this->api->getSitesAccessFromUser($user2);
     $expected = array(array('site' => 1, 'access' => 'admin'), array('site' => 2, 'access' => 'admin'), array('site' => 3, 'access' => 'admin'));
     $this->assertEquals($expected, $access);
 }
 /**
  * Decrypts the password and calls the original function on the decrypted value.
  *
  * @see the parent class function for parameters and return value
  */
 public function addUser($userLogin, $password, $email, $alias = false, $_isPasswordHashed = false)
 {
     $password = Crypto::decrypt($password);
     return parent::addUser($userLogin, $password, $email, $alias, $_isPasswordHashed);
 }