You are here

public function UserHelpTabAccess::accessLdapHelpTab in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_authentication/src/Access/UserHelpTabAccess.php \Drupal\ldap_authentication\Access\UserHelpTabAccess::accessLdapHelpTab()

Access callback for help tab.

Return value

bool Whether user is allowed to see tab or not.

1 call to UserHelpTabAccess::accessLdapHelpTab()
UserHelpTabAccess::access in ldap_authentication/src/Access/UserHelpTabAccess.php

File

ldap_authentication/src/Access/UserHelpTabAccess.php, line 33

Class

UserHelpTabAccess
Checks whether the use is allowed to see the help tab.

Namespace

Drupal\ldap_authentication\Access

Code

public function accessLdapHelpTab() {
  $mode = $this->config
    ->get('authenticationMode');
  if ($mode == LdapAuthenticationConfiguration::MODE_MIXED) {
    if (ldap_authentication_ldap_authenticated($this->currentUser)) {
      return TRUE;
    }
  }
  elseif ($mode == LdapAuthenticationConfiguration::MODE_EXCLUSIVE) {
    if ($this->currentUser
      ->isAnonymous() || ldap_authentication_ldap_authenticated($this->currentUser)) {
      return TRUE;
    }
  }
  return FALSE;
}