public function LicenseFileManager::shouldLogDownload in Commerce File 8.2
Determines whether the download should be logged for the given license.
Parameters
\Drupal\commerce_license\Entity\LicenseInterface $license: The license.
\Drupal\Core\Session\AccountInterface|null $account: The account to check for. If null, the current user is used instead.
Return value
bool Whether the download should be logged.
Overrides LicenseFileManagerInterface::shouldLogDownload
File
- src/
LicenseFileManager.php, line 208
Class
- LicenseFileManager
- Provides a service for managing licensed files.
Namespace
Drupal\commerce_fileCode
public function shouldLogDownload(LicenseInterface $license, AccountInterface $account = NULL) {
$account = $account ?: $this->currentUser;
if ($account
->hasPermission('bypass license control') || $account
->hasPermission('administer commerce_license')) {
return FALSE;
}
return $account
->id() == $license
->getOwnerId();
}