function permissions_by_term_user_cancel in Permissions by Term 8.2
Same name and namespace in other branches
- 8 permissions_by_term.module \permissions_by_term_user_cancel()
Implements hook_user_cancel().
Deletes all term permissions for a user when their account is cancelled.
File
- ./
permissions_by_term.module, line 548 - Allows access to terms in a vocabulary to be limited by user or role.
Code
function permissions_by_term_user_cancel($edit, $account, $method) {
$deleted_user_id = $account
->id();
/* @var AccessStorage $access_storage */
$access_storage = \Drupal::service('permissions_by_term.access_storage');
$access_storage
->deleteAllTermPermissionsByUserId($deleted_user_id);
/**
* @var \Drupal\permissions_by_term\Cache\CacheInvalidator $cacheInvalidator
*/
$cacheInvalidator = \Drupal::service('permissions_by_term.cache_invalidator');
$cacheInvalidator
->invalidate();
}