forked from fsulib/embargoes
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from qadan/behaviour-fixes
fixing behaviour
- Loading branch information
Showing
6 changed files
with
90 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Drupal\embargoes\Access; | ||
|
||
use Drupal\file\FileAccessControlHandler; | ||
use Drupal\Core\Entity\EntityInterface; | ||
use Drupal\Core\Session\AccountInterface; | ||
|
||
/** | ||
* Extends checkAccess to check embargoed access. | ||
*/ | ||
class EmbargoesFileAccessHandler extends FileAccessControlHandler { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { | ||
$embargoed = \Drupal::service('embargoes.file_access')->isActivelyEmbargoed($entity, $account); | ||
if ($embargoed->isForbidden()) { | ||
return $embargoed; | ||
} | ||
return parent::checkAccess($entity, $operation, $account); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters