public function DownloadFileAccess::access 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 if user has a permission and own the file.
Parameters
\Drupal\Core\Session\AccountInterface $account: Account to check access for.
\Drupal\file\FileInterface $file: File to grant access for.
Return value
\Drupal\Core\Access\AccessResult Access checking result.
1 string reference to 'DownloadFileAccess::access'
- bibcite_export.routing.yml in modules/
bibcite_export/ bibcite_export.routing.yml - modules/bibcite_export/bibcite_export.routing.yml
File
- modules/
bibcite_export/ src/ Access/ DownloadFileAccess.php, line 26
Class
- DownloadFileAccess
- Access check for file, generate by "Export all" form.
Namespace
Drupal\bibcite_export\AccessCode
public function access(AccountInterface $account, FileInterface $file) {
return AccessResult::allowedIf(($account
->hasPermission('administer bibcite') || $account
->hasPermission('access bibcite export')) && $file
->getOwnerId() == $account
->id());
}