You are here

protected function ConfigTranslationOverviewAccess::doCheckAccess in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/config_translation/src/Access/ConfigTranslationOverviewAccess.php \Drupal\config_translation\Access\ConfigTranslationOverviewAccess::doCheckAccess()
  2. 10 core/modules/config_translation/src/Access/ConfigTranslationOverviewAccess.php \Drupal\config_translation\Access\ConfigTranslationOverviewAccess::doCheckAccess()

Checks access given an account, configuration mapper, and source language.

Grants access if the proper permission is granted to the account, the configuration has translatable pieces, and the source language is not locked given it is present.

Parameters

\Drupal\Core\Session\AccountInterface $account: The account to check access for.

\Drupal\config_translation\ConfigMapperInterface $mapper: The configuration mapper to check access for.

\Drupal\Core\Language\LanguageInterface|null $source_language: The source language to check for, if any.

Return value

\Drupal\Core\Access\AccessResultInterface The result of the access check.

2 calls to ConfigTranslationOverviewAccess::doCheckAccess()
ConfigTranslationFormAccess::doCheckAccess in core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php
Checks access given an account, configuration mapper, and source language.
ConfigTranslationOverviewAccess::access in core/modules/config_translation/src/Access/ConfigTranslationOverviewAccess.php
Checks access to the overview based on permissions and translatability.
1 method overrides ConfigTranslationOverviewAccess::doCheckAccess()
ConfigTranslationFormAccess::doCheckAccess in core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php
Checks access given an account, configuration mapper, and source language.

File

core/modules/config_translation/src/Access/ConfigTranslationOverviewAccess.php, line 106

Class

ConfigTranslationOverviewAccess
Checks access for displaying the configuration translation overview.

Namespace

Drupal\config_translation\Access

Code

protected function doCheckAccess(AccountInterface $account, ConfigMapperInterface $mapper, $source_language = NULL) {
  $access = $account
    ->hasPermission('translate configuration') && $mapper
    ->hasSchema() && $mapper
    ->hasTranslatable() && (!$source_language || !$source_language
    ->isLocked());
  return AccessResult::allowedIf($access)
    ->cachePerPermissions();
}