getAttributeMap() публичный Метод

Get the map of names to actual LDAP attribute names.
public getAttributeMap ( ) : array
Результат array
Пример #1
0
 /**
  * Determine what attributes should be selected. This accounts for a query wanting all attributes.
  *
  * @param array $selected
  * @param array $entry
  * @return array
  */
 protected function getSelectedAttributes(array $selected, array $entry)
 {
     if (count($selected) === 1 && $selected[0] == '*' && !$this->schema) {
         $selected = array_keys($entry);
     } elseif (count($selected) === 1 && $selected[0] == '*' && $this->schema) {
         $selected = array_unique(array_merge(array_keys($this->schema->getAttributeMap()), array_keys($entry)));
     }
     return $selected;
 }
Пример #2
0
 /**
  * Determine what attributes should be selected. This helps account for all attributes being selected both within
  * and out of the context of a schema.
  *
  * @param array $attributes
  * @param LdapObjectSchema|null $schema
  * @return array
  */
 protected function getSelectedQueryAttributes(array $attributes, LdapObjectSchema $schema = null)
 {
     // Interpret a single wildcard as only schema attributes.
     if ($schema && !empty($attributes) && $attributes[0] == '*') {
         $attributes = array_keys($schema->getAttributeMap());
         // Interpret a double wildcard as all LDAP attributes even if they aren't in the schema file.
     } elseif ($schema && !empty($attributes) && $attributes[0] == '**') {
         $attributes = ['*'];
     }
     return $attributes;
 }
Пример #3
0
 /**
  * Validate that an object schema meets the minimum requirements.
  *
  * @param LdapObjectSchema $schema
  * @throws SchemaParserException
  */
 protected function validateObjectSchema($schema)
 {
     if (empty($schema->getAttributeMap())) {
         throw new SchemaParserException(sprintf('Object type "%s" has no attributes defined.', $schema->getObjectType()));
     } elseif (!(bool) count(array_filter(array_keys($schema->getAttributeMap()), 'is_string'))) {
         throw new SchemaParserException('The attributes for a schema should be an associative array.');
     }
     if ($schema->getScope() && !in_array($schema->getScope(), QueryOperation::SCOPE)) {
         throw new SchemaParserException(sprintf('The scope "%s" is not valid. Valid types are: %s', $schema->getScope(), implode(', ', QueryOperation::SCOPE)));
     }
 }