You are here

function ldap_authorization_get_consumers in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_authorization/ldap_authorization.module \ldap_authorization_get_consumers()
  2. 7 ldap_authorization/ldap_authorization.module \ldap_authorization_get_consumers()

Parameters

string $consumer_type: is machine name of consumer type such as "drupal_role".

bool $reset: signifies clear static variable.

bool $flatten: signies return individual consumer not keyed on consumer type.

Return value

array (1) if $flatten is true, consumer configuration array otherwise (2) associative array of consumer configurations keyed on consumer type such as "drupal_role"

10 calls to ldap_authorization_get_consumers()
LdapAuthenticationConf::allowUser in ldap_authentication/LdapAuthenticationConf.class.php
Decide if a username is excluded or not.
LdapAuthenticationTestCase::testAuthenticationWhitelistTests in ldap_authentication/tests/ldap_authentication.test
LdapAuthorizationConsumerConfAdmin::__construct in ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php
Constructor Method.
LdapAuthorizationOg2Tests::testFlags in ldap_authorization/tests/Og2Tests.test
Authorization configuration flags tests clumped together.
ldap_authorizations_admin_index in ldap_authorization/ldap_authorization.admin.inc
Index of ldap authorization configurations.

... See full list

File

ldap_authorization/ldap_authorization.module, line 230
Ldap authorization module.

Code

function ldap_authorization_get_consumers($consumer_type = NULL, $reset = FALSE, $flatten = FALSE) {
  static $consumers;
  if ($reset || !is_array($consumers)) {
    $consumers = module_invoke_all('ldap_authorization_consumer');
  }
  if (!$consumer_type) {
    return $consumers;
  }
  elseif ($flatten) {
    return isset($consumers[$consumer_type]) ? $consumers[$consumer_type] : FALSE;
  }
  else {
    return isset($consumers[$consumer_type]) ? [
      $consumer_type => $consumers[$consumer_type],
    ] : [];
  }
}