Skip to content

Commit

Permalink
update permissions hook
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Mar 18, 2018
1 parent b2f269f commit 55944ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/Directus/Application/CoreServicesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ protected function getEmitter()
$emitter->addAction('table.update.directus_privileges:after', function ($data) use($container, $cachePool) {
$acl = $container->get('acl');
$dbConnection = $container->get('database');
$privileges = new DirectusPrivilegesTableGateway($dbConnection, $acl);
$privileges = new DirectusPermissionsTableGateway($dbConnection, $acl);
$record = $privileges->fetchById($data['id']);
$cachePool->invalidateTags(['privilege_table_'.$record['table_name'].'_group_'.$record['group_id']]);
$cachePool->invalidateTags(['permissions_collection_'.$record['collection'].'_group_'.$record['group']]);
});
// /Cache subscriptions

Expand Down
2 changes: 1 addition & 1 deletion src/core/Directus/Services/AbstractService.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ protected function getDataAndSetResponseCacheTags(Callable $callable, array $cal
$tableName = $payload->attribute('tableName');

$this->tagResponseCache('table_'.$tableName);
$this->tagResponseCache('privilege_table_'.$tableName.'_group_'.$container->get('acl')->getGroupId());
$this->tagResponseCache('permissions_collection_'.$tableName.'_group_'.$container->get('acl')->getGroupId());

foreach($payload->getData() as $item) {
$this->tagResponseCache('entity_'.$tableName.'_'.$item[$pkName]);
Expand Down

0 comments on commit 55944ee

Please sign in to comment.