You are here

class MandrillConfigurationAccessCheck in Mandrill 8

Checks access for displaying configuration page.

Hierarchy

Expanded class hierarchy of MandrillConfigurationAccessCheck

1 string reference to 'MandrillConfigurationAccessCheck'
mandrill.services.yml in ./mandrill.services.yml
mandrill.services.yml
1 service uses MandrillConfigurationAccessCheck
access_check.mandrill.configuration in ./mandrill.services.yml
Drupal\mandrill\Access\MandrillConfigurationAccessCheck

File

src/Access/MandrillConfigurationAccessCheck.php, line 12

Namespace

Drupal\mandrill\Access
View source
class MandrillConfigurationAccessCheck implements AccessInterface {

  /**
   * Access check for Mandrill module configuration.
   *
   * Ensures a Mandrill API key has been provided.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public function access(AccountInterface $account) {
    $config = \Drupal::configFactory()
      ->get('mandrill.settings');
    $api_key = $config
      ->get('mandrill_api_key');
    return AccessResult::allowedIf(!empty($api_key));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MandrillConfigurationAccessCheck::access public function Access check for Mandrill module configuration.