public function test_makeConfigured_CreatesCorrectInstance_WhenNoConfigOptionsSpecified()
 {
     $parser = UserAccessAttributeParser::makeConfigured();
     $this->assertEquals(';', $parser->getServerSpecificationDelimiter());
     $this->assertEquals(':', $parser->getServerIdsSeparator());
     $this->assertNull($parser->getThisPiwikInstanceName());
 }
 /**
  * Returns a configured UserAccessMapper instance. The instance is configured
  * using INI config option values.
  *
  * @return UserAccessMapper
  */
 public static function makeConfigured()
 {
     $result = new UserAccessMapper();
     $result->setUserAccessAttributeParser(UserAccessAttributeParser::makeConfigured());
     $viewAttributeName = Config::getLdapViewAccessField();
     if (!empty($viewAttributeName)) {
         $result->setViewAttributeName($viewAttributeName);
     }
     $adminAttributeName = Config::getLdapAdminAccessField();
     if (!empty($adminAttributeName)) {
         $result->setAdminAttributeName($adminAttributeName);
     }
     $superuserAttributeName = Config::getSuperUserAccessField();
     if (!empty($superuserAttributeName)) {
         $result->setSuperuserAttributeName($superuserAttributeName);
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Returns a configured UserAccessMapper instance. The instance is configured
  * using INI config option values.
  *
  * @return UserAccessMapper
  */
 public static function makeConfigured()
 {
     $result = new UserAccessMapper();
     $result->setUserAccessAttributeParser(UserAccessAttributeParser::makeConfigured());
     $viewAttributeName = Config::getLdapViewAccessField();
     if (!empty($viewAttributeName)) {
         $result->setViewAttributeName($viewAttributeName);
     }
     $adminAttributeName = Config::getLdapAdminAccessField();
     if (!empty($adminAttributeName)) {
         $result->setAdminAttributeName($adminAttributeName);
     }
     $superuserAttributeName = Config::getSuperUserAccessField();
     if (!empty($superuserAttributeName)) {
         $result->setSuperuserAttributeName($superuserAttributeName);
     }
     Log::debug("UserAccessMapper::%s: configuring with viewAttributeName = '%s', adminAttributeName = '%s', superuserAttributeName = '%s'", __FUNCTION__, $viewAttributeName, $adminAttributeName, $superuserAttributeName);
     return $result;
 }