You are here

function ldap_authorizations_user_authorizations in Lightweight Directory Access Protocol (LDAP) 7

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

@rationale: need not be called from hook_user, so this function separated out so it can be called from a batch synchronization process for example

Parameters

drupal user object $user:

string $op indicateing operation such as query, set, test_query, etc.:

string $consumer_type e.g. drupal_role, or og_groups:

string $context:

Return value

array of form: $authorizations[<consumer_type>][<authorization_id>]

11 calls to ldap_authorizations_user_authorizations()
LdapAuthenticationConf::allowUser in ldap_authentication/LdapAuthenticationConf.class.php
decide if a username is excluded or not
LdapAuthorizationBasicTests::testFlags in ldap_authorization/tests/BasicTests/BasicTests.test
flag (binary switches) tests clumped together
LdapAuthorizationDerivationsTests::testDeriveFromEntry in ldap_authorization/tests/DeriveFromEntry/DeriveFromEntry.test
LdapAuthorizationDerivationsTests::testDeriveFromEntryNested in ldap_authorization/tests/DeriveFromEntry/DeriveFromEntry.test
LdapAuthorizationDeriveEntry::testDeriveFromDN in ldap_authorization/tests/DeriveFromDN/DeriveFromDN.test

... See full list

File

ldap_authorization/ldap_authorization.module, line 234
ldap authorization module

Code

function ldap_authorizations_user_authorizations(&$user, $op = 'query', $consumer_type = NULL, $context = NULL) {
  ldap_server_module_load_include('inc', 'ldap_authorization', 'ldap_authorization');
  if ($consumer_type != NULL) {
    list($new_authorizations, $notifications) = _ldap_authorizations_user_authorizations($user, $op, $consumer_type, $context);
  }
  else {
    $consumers = ldap_authorization_get_consumers();
    $new_authorizations = array();
    $notifications = array();
    foreach ($consumers as $consumer_type => $consumer) {
      list($new_authorizations_i, $notifications_i) = _ldap_authorizations_user_authorizations($user, $op, $consumer_type, $context);
      $new_authorizations = $new_authorizations + $new_authorizations_i;
      $notifications = $notifications + $notifications_i;
    }
  }
  return array(
    $new_authorizations,
    $notifications,
  );
}