public function test_getInstance()
 {
     $conn = Factory::getConnection();
     $auth = new Xoops_Auth_ProvisioningTest_AuthAbstractInstance($conn);
     $instance = \Xoops\Auth\Provisioning::getInstance($auth);
     $instance2 = \Xoops\Auth\Provisioning::getInstance($auth);
     $this->assertSame($instance, $instance2);
 }
Beispiel #2
0
 /**
  * loadXoopsUser
  *
  * @param string $userdn base DN for the directory
  * @param string $uname  username
  * @param string $pwd    pasword
  *
  * @return bool|XoopsUser
  */
 public function loadXoopsUser($userdn, $uname, $pwd = null)
 {
     $xoopsUser = false;
     $provisHandler = Provisioning::getInstance($this);
     $sr = ldap_read($this->ds, $userdn, '(objectclass=*)');
     $entries = ldap_get_entries($this->ds, $sr);
     if ($entries['count'] > 0) {
         $xoopsUser = $provisHandler->sync($entries[0], $uname, $pwd);
     } else {
         $this->setErrors(0, sprintf('loadXoopsUser - ' . \XoopsLocale::EF_ENTRY_NOT_READ, $userdn));
     }
     return $xoopsUser;
 }