You are here

public function MediaLibraryGutenbergOpener::checkAccess in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 src/MediaLibraryGutenbergOpener.php \Drupal\gutenberg\MediaLibraryGutenbergOpener::checkAccess()

Checks media library access.

Parameters

\Drupal\media_library\MediaLibraryState $state: The media library.

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

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

Overrides MediaLibraryOpenerInterface::checkAccess

See also

https://www.drupal.org/project/drupal/issues/3038254

File

src/MediaLibraryGutenbergOpener.php, line 21

Class

MediaLibraryGutenbergOpener
The media library opener for Gutenberg editor.

Namespace

Drupal\gutenberg

Code

public function checkAccess(MediaLibraryState $state, AccountInterface $account) {
  return AccessResult::allowedIf($account
    ->hasPermission('use gutenberg'));
}