コード例 #1
0
ファイル: access.php プロジェクト: olucao/owncloud-core
 /**
  * @param string $name
  * @param string $password
  * @return bool
  */
 public function areCredentialsValid($name, $password)
 {
     $name = $this->DNasBaseParameter($name);
     $testConnection = clone $this->connection;
     $credentials = array('ldapAgentName' => $name, 'ldapAgentPassword' => $password);
     if (!$testConnection->setConfiguration($credentials)) {
         return false;
     }
     $result = $testConnection->bind();
     $this->connection->bind();
     return $result;
 }
コード例 #2
0
ファイル: testconfig.php プロジェクト: olucao/owncloud-core
 /**
  * tests the specified connection
  * @param string $configID
  * @return int
  */
 protected function testConfig($configID)
 {
     $lw = new \OCA\user_ldap\lib\LDAP();
     $connection = new Connection($lw, $configID);
     //ensure validation is run before we attempt the bind
     $connection->getConfiguration();
     if (!$connection->setConfiguration(array('ldap_configuration_active' => 1))) {
         return 1;
     }
     if ($connection->bind()) {
         return 0;
     }
     return 2;
 }