You are here

function ldap_authorizations_user_authorizations in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_authorization/ldap_authorization.module \ldap_authorizations_user_authorizations()
  2. 7 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

object $user:

string $op: indicating 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>]

5 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.test
Authorization configuration flags tests clumped together.
LdapAuthorizationOg2Tests::testFlags in ldap_authorization/tests/Og2Tests.test
Authorization configuration flags tests clumped together.
ldap_authorization_test_form_submit in ldap_authorization/ldap_authorization.admin.test.inc
Submit handler function for ldap_authorization_test.
ldap_authorization_user_login in ldap_authorization/ldap_authorization.module
Implements hook_user_login() login operation.

File

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

Code

function ldap_authorizations_user_authorizations(&$user, $op = 'query', $consumer_type = NULL, $context = NULL) {
  ldap_servers_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 = [];
    $notifications = [];
    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 [
    $new_authorizations,
    $notifications,
  ];
}