class DownloadFileAccess in Bibliography & Citation 2.0.x
Same name and namespace in other branches
- 8 modules/bibcite_export/src/Access/DownloadFileAccess.php \Drupal\bibcite_export\Access\DownloadFileAccess
Access check for file, generate by "Export all" form.
Hierarchy
- class \Drupal\bibcite_export\Access\DownloadFileAccess implements AccessInterface
Expanded class hierarchy of DownloadFileAccess
File
- modules/bibcite_export/ src/ Access/ DownloadFileAccess.php, line 13 
Namespace
Drupal\bibcite_export\AccessView source
class DownloadFileAccess implements AccessInterface {
  /**
   * Check if user has a permission and own the file.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Account to check access for.
   * @param \Drupal\file\FileInterface $file
   *   File to grant access for.
   *
   * @return \Drupal\Core\Access\AccessResult
   *   Access checking result.
   */
  public function access(AccountInterface $account, FileInterface $file) {
    return AccessResult::allowedIf(($account
      ->hasPermission('administer bibcite') || $account
      ->hasPermission('access bibcite export')) && $file
      ->getOwnerId() == $account
      ->id());
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| DownloadFileAccess:: | public | function | Check if user has a permission and own the file. | 
