public function SimpleLdapSchema::get in Simple LDAP 7
Same name and namespace in other branches
- 7.2 SimpleLdapSchema.class.php \SimpleLdapSchema::get()
Fetches entries of the given type.
@throw SimpleLdapException
Parameters
string $attribute: Name of the schema attribute type to return.
string $name: If specified, a single entry with this name or OID is returned.
Return value
array The requested attribute list or entry.
3 calls to SimpleLdapSchema::get()
- SimpleLdapSchema::may in ./
SimpleLdapSchema.class.php - Return a list of attributes specified as MAY for the objectclass.
- SimpleLdapSchema::must in ./
SimpleLdapSchema.class.php - Return a list of attributes specified as MUST for the objectclass.
- SimpleLdapSchema::superclass in ./
SimpleLdapSchema.class.php - Returns the objectclass's superclass.
File
- ./
SimpleLdapSchema.class.php, line 140 - Class to represent an LDAP server schema.
Class
- SimpleLdapSchema
- Simple LDAP Schema class.
Code
public function get($attribute, $name = NULL) {
if ($this
->exists($attribute, $name)) {
$attribute = drupal_strtolower($attribute);
if ($name === NULL) {
return $this->schema[$attribute];
}
else {
$name = drupal_strtolower($name);
if (isset($this->schema[$attribute][$name])) {
// Return a named attribute.
return $this->schema[$attribute][$name];
}
else {
// Search for an alias or OID.
foreach ($this->schema[$attribute] as $attr) {
foreach ($attr['aliases'] as $alias) {
if (drupal_strtolower($alias) == drupal_strtolower($name)) {
return $attr;
}
}
if ($attr['oid'] == $name) {
return $attr;
}
}
}
}
}
throw new SimpleLdapException('The requested entry does not exist: ' . $attribute . ', ' . $name);
}