public function FileReplaceAccessCheck::access in File Replace (D8) 8
Checks access for replacing a file.
Parameters
\Drupal\Core\Session\AccountInterface $account: The currently logged in account.
\Drupal\file\FileInterface $file: The file to check access for.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
File
- src/
Access/ FileReplaceAccessCheck.php, line 44
Class
- FileReplaceAccessCheck
- Determines access to replacing a file.
Namespace
Drupal\file_replace\AccessCode
public function access(AccountInterface $account, FileInterface $file) {
return AccessResult::allowedIf($account
->hasPermission('replace files') && $file
->isPermanent());
}