You are here

function ldap_user_ldap_provision_semaphore in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_user/ldap_user.module \ldap_user_ldap_provision_semaphore()

function to avoid multiple synch or provision in same page load (if desired)

Parameters

enum string $action 'synch' | 'provision' | 'set_page_load_key' | NULL: @param enum string $op = 'set' or 'get' @value mixed value associate with $op.

7 calls to ldap_user_ldap_provision_semaphore()
LdapUserIntegrationTests::testProvisionToLdap in ldap_user/tests/ldap_user.test
integration tests for provisioning to ldap
LdapUserUnitTests::testProvisionToDrupal in ldap_user/tests/ldap_user.test
ldap_user_conf_cache_clear in ldap_user/ldap_user.module
ldap_user_init in ldap_user/ldap_user.module
Implements hook_init().
ldap_user_user_insert in ldap_user/ldap_user.module
Implements hook_user_insert().

... See full list

File

ldap_user/ldap_user.module, line 786
Module for the LDAP User Entity

Code

function ldap_user_ldap_provision_semaphore($action, $op, $value = NULL, $reset = FALSE) {
  $calling_function = FALSE;
  if (function_exists('debug_backtrace') && ($backtrace = debug_backtrace())) {

    //   {
    $calling_function = $backtrace[1]['function'];
  }
  static $ldap_accts;
  static $intialized;
  if ($reset || !$intialized) {
    $ldap_accts = array();
    $intialized = TRUE;
  }

  // mark that the given drupal user has had ldap entry synched or provisioned on this page load.
  if ($op == 'set') {
    if ($action && $value) {
      $ldap_accts[$action][$value] = TRUE;
    }
    return;
  }

  // has the given drupal user x action (synch or provision) been executed.
  if ($op == 'get') {
    if ($action && $value && isset($ldap_accts[$action][$value])) {
      return $ldap_accts[$action][$value];
    }
    else {
      return FALSE;
    }
  }
}