You are here

private function ServerListBuilder::checkStatus in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_servers/src/ServerListBuilder.php \Drupal\ldap_servers\ServerListBuilder::checkStatus()

Format a server status response.

Parameters

\Drupal\ldap_servers\Entity\Server $server: Server.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The status string.

1 call to ServerListBuilder::checkStatus()
ServerListBuilder::buildRow in ldap_servers/src/ServerListBuilder.php
Builds a row for an entity in the entity listing.

File

ldap_servers/src/ServerListBuilder.php, line 86

Class

ServerListBuilder
Provides a listing of Server entities.

Namespace

Drupal\ldap_servers

Code

private function checkStatus(Server $server) : TranslatableMarkup {

  /** @var \Drupal\ldap_servers\LdapBridge $bridge */
  $bridge = \Drupal::service('ldap.bridge');
  $bridge
    ->setServer($server);
  if ($server
    ->get('status')) {
    if ($bridge
      ->bind()) {
      $result = $this
        ->t('Server available');
    }
    else {
      $result = $this
        ->t('Binding issues, please see log.');
    }
  }
  else {
    $result = $this
      ->t('Deactivated');
  }
  return $result;
}