You are here

public static function ExternalAuthenticationHelper::excludeUser in Lightweight Directory Access Protocol (LDAP) 8.3

Check if user is excluded.

Parameters

mixed $account: A Drupal user object.

Return value

bool TRUE if user should be excluded from LDAP provision/syncing

5 calls to ExternalAuthenticationHelper::excludeUser()
DrupalUserProcessor::drupalUserLogsIn in ldap_user/src/Processor/DrupalUserProcessor.php
Handle Drupal user login.
DrupalUserProcessor::drupalUserUpdated in ldap_user/src/Processor/DrupalUserProcessor.php
Callback for hook_ENTITY_TYPE_update().
DrupalUserProcessor::newDrupalUserCreated in ldap_user/src/Processor/DrupalUserProcessor.php
Callback for hook_ENTITY_TYPE_insert().
ExternalAuthenticationHelperTests::testUserExclusion in ldap_user/tests/src/Unit/ExternalAuthenticationHelperTests.php
Tests user exclusion for the authentication helper.
LDAPAuthorizationProvider::getProposals in ldap_authorization/src/Plugin/authorization/Provider/LDAPAuthorizationProvider.php
Get the proposals for this users.

File

ldap_user/src/Helper/ExternalAuthenticationHelper.php, line 74

Class

ExternalAuthenticationHelper
Helper class to wrap external_auth service.

Namespace

Drupal\ldap_user\Helper

Code

public static function excludeUser($account = NULL) {

  // @TODO 2914053.
  // Always exclude user 1.
  if (is_object($account) && $account
    ->id() == 1) {
    return TRUE;
  }

  // Exclude users who have been manually flagged as excluded.
  if (is_object($account) && $account
    ->get('ldap_user_ldap_exclude')->value == 1) {
    return TRUE;
  }

  // Everyone else is fine.
  return FALSE;
}