You are here

public function SimpleLdapServerSchema::getMustAttributes in Simple LDAP 8

Return a list of attributes specified as MUST for the objectclass.

Parameters

string $objectclass: The objectclass to query for attributes.

boolean $recursive: If TRUE, the attributes of the parent objectclasses will also be retrieved.

Return value

array A list of the MUST attributes.

Throws

SimpleLdapException

1 call to SimpleLdapServerSchema::getMustAttributes()
SimpleLdapServerSchema::getAttributesByObjectClass in src/SimpleLdapServerSchema.php
Return a list of attributes defined for the objectclass.

File

src/SimpleLdapServerSchema.php, line 438
Contains \Drupal\simple_ldap\SimpleLdapServerSchema

Class

SimpleLdapServerSchema

Namespace

Drupal\simple_ldap

Code

public function getMustAttributes($objectclass, $recursive = FALSE) {
  $oc = $this
    ->getSchemaItem('objectclasses', $objectclass);
  $must = array();
  if (isset($oc['must'])) {
    $must = $oc['must'];
  }
  if ($recursive && isset($oc['sup'])) {
    foreach ($oc['sup'] as $sup) {
      $must = array_merge($must, $this
        ->getMustAttributes($sup, TRUE));
    }
  }
  return $must;
}