Пример #1
0
 public function testResolveBindRegisteredDomain()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     if (!ZurmoTestHelper::isAuthenticationLdapTestConfigurationSet()) {
         $this->markTestSkipped(Zurmo::t('ZurmoModule', 'Test Ldap settings are not configured in perInstanceTest.php file.'));
     }
     //to show the fix for resolveBindRegisteredDomain with incorrect Base Domain
     $bindRegisteredDomain = LdapUtil::resolveBindRegisteredDomain('testUser', 'test');
     $this->assertEquals('testUser', $bindRegisteredDomain);
     //to show the fix for resolveBindRegisteredDomain with correct Base Domain
     $bindRegisteredDomain = LdapUtil::resolveBindRegisteredDomain('test', 'dc=server,dc=local');
     // Not Coding Standard
     $this->assertEquals('*****@*****.**', $bindRegisteredDomain);
 }
 public function testSuperUserResolveBindRegisteredDomain()
 {
     if (!ZurmoTestHelper::isAuthenticationLdapTestConfigurationSet()) {
         $this->markTestSkipped(Zurmo::t('ZurmoModule', 'Test Ldap settings are not configured in perInstanceTest.php file.'));
     }
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //check Ldap connection
     $this->resetGetArray();
     $this->setPostArray(array('LdapConfigurationForm' => array('serverType' => Yii::app()->authenticationHelper->ldapServerType, 'host' => Yii::app()->authenticationHelper->ldapHost, 'port' => Yii::app()->authenticationHelper->ldapPort, 'bindRegisteredDomain' => Yii::app()->authenticationHelper->ldapBindRegisteredDomain, 'bindPassword' => Yii::app()->authenticationHelper->ldapBindPassword, 'baseDomain' => 'testBaseDomain', 'enabled' => Yii::app()->authenticationHelper->ldapEnabled)));
     $content = $this->runControllerWithNoExceptionsAndGetContent('zurmo/ldap/testConnection');
     $this->assertTrue(strpos($content, "Unable to connect to Ldap server") > 0);
 }
Пример #3
0
 /**
  * Test case when same user exists in ldap server and in Zurmo users
  */
 public function testUserExitsInldapAndZurmo()
 {
     if (!ZurmoTestHelper::isAuthenticationLdapTestConfigurationSet()) {
         $this->markTestSkipped(Zurmo::t('Default', 'Test Ldap settings are not configured in perInstanceTest.php file.'));
     }
     Yii::app()->user->userModel = User::getByUsername('super');
     $username = Yii::app()->authenticationHelper->ldapBindRegisteredDomain;
     $password = Yii::app()->authenticationHelper->ldapBindPassword;
     $identity = new UserLdapIdentity($username, $password);
     $authenticated = $identity->authenticate(true);
     $this->assertEquals(0, $identity->errorCode);
     $this->assertTrue($authenticated);
 }