function _tft_term_access in Taxonomy File Tree 8
Same name and namespace in other branches
- 3.x tft.module \_tft_term_access()
Check if the user has access to the term.
Parameters
int $tid: The term tid.
null|mixed $account: The user account to check against. If no account is given, the current user will be used.
Return value
bool TRUE if the user has access to this term. FALSE otherwise.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
7 calls to _tft_term_access()
- AddFolderForm::validateForm in src/
Form/ AddFolderForm.php - Form validation handler.
- TFTController::downloadFile in src/
Controller/ TFTController.php - Downloads file.
- TFTController::get_folder_operation_links in src/
Controller/ TFTController.php - Return an <ul> with links for the current folder.
- TFTController::tft in src/
Controller/ TFTController.php - File explorer.
- tft_taxonomy_term_access in ./
tft.module - Implements hook_ENTITY_TYPE_access().
File
- ./
tft.module, line 208 - Contains tft.module.
Code
function _tft_term_access($tid, $account = NULL) {
if (!$tid && $tid != 0) {
return FALSE;
}
if (!$account) {
$account = \Drupal::currentUser();
}
if ($account
->id() === 1 || $account
->hasPermission(TFT_ACCESS_FULL_TREE) || $account
->hasPermission(TFT_ADMIN) || $account
->hasPermission('administer taxonomy')) {
return TRUE;
}
// Is this part of a Group?
if ($gid = _tft_get_group_gid($tid)) {
// Check against Group.
return Group::load($gid)
->access('take', $account);
}
return FALSE;
}