You are here

function ldap_user_ldap_provision_semaphore in Lightweight Directory Access Protocol (LDAP) 7.2

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

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

@value mixed value associate with $op.

Parameters

enum string $action: 'synch' | 'provision' | 'set_page_load_key' | NULL.

enum string $op: = 'set' or 'get'.

Return value

bool|void

9 calls to ldap_user_ldap_provision_semaphore()
LdapUserConf::provisionDrupalAccount in ldap_user/LdapUserConf.class.php
Given a drupal account, query ldap and get all user fields and save user account (note: parameters are in odd order to match synchDrupalAccount handle)
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().

... See full list

File

ldap_user/ldap_user.module, line 804
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 = [];
    $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;
    }
  }
}