function MediaAccessControlHandler::checkCreateAccess

Same name in other branches
  1. 9 core/modules/media/src/MediaAccessControlHandler.php \Drupal\media\MediaAccessControlHandler::checkCreateAccess()
  2. 8.9.x core/modules/media/src/MediaAccessControlHandler.php \Drupal\media\MediaAccessControlHandler::checkCreateAccess()
  3. 10 core/modules/media/src/MediaAccessControlHandler.php \Drupal\media\MediaAccessControlHandler::checkCreateAccess()

Overrides EntityAccessControlHandler::checkCreateAccess

File

core/modules/media/src/MediaAccessControlHandler.php, line 153

Class

MediaAccessControlHandler
Defines an access control handler for media items.

Namespace

Drupal\media

Code

protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
    $permissions = [
        'administer media',
        'create media',
        'create ' . $entity_bundle . ' media',
    ];
    return AccessResult::allowedIfHasPermissions($account, $permissions, 'OR');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.