class MigrateAccessCheck
Same name in other branches
- 9 core/modules/migrate_drupal_ui/src/MigrateAccessCheck.php \Drupal\migrate_drupal_ui\MigrateAccessCheck
- 8.9.x core/modules/migrate_drupal_ui/src/MigrateAccessCheck.php \Drupal\migrate_drupal_ui\MigrateAccessCheck
- 11.x core/modules/migrate_drupal_ui/src/MigrateAccessCheck.php \Drupal\migrate_drupal_ui\MigrateAccessCheck
Checks access for migrate_drupal_ui routes.
The Migrate Drupal UI can only be used by user 1. This is because any other user might have different permissions on the source and target site.
This class is designed to be used with '_custom_access' route requirement.
Hierarchy
- class \Drupal\migrate_drupal_ui\MigrateAccessCheck
Expanded class hierarchy of MigrateAccessCheck
See also
\Drupal\Core\Access\CustomAccessCheck
File
-
core/
modules/ migrate_drupal_ui/ src/ MigrateAccessCheck.php, line 18
Namespace
Drupal\migrate_drupal_uiView source
class MigrateAccessCheck {
/**
* Checks if the user is user 1 and grants access if so.
*
* @param \Drupal\Core\Session\AccountInterface $account
* The current user account.
*
* @return \Drupal\Core\Access\AccessResult
* The access result.
*/
public function checkAccess(AccountInterface $account) {
// The access result is uncacheable because it is just limiting access to
// the migrate UI which is not worth caching.
return AccessResultAllowed::allowedIf((int) $account->id() === 1)
->mergeCacheMaxAge(0);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
MigrateAccessCheck::checkAccess | public | function | Checks if the user is user 1 and grants access if so. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.