protected function LogAutocompleteController::typeOfAccess in Log entity 2.x
Helper function that returns what filter must be applied to the user query.
Parameters
string $log_bundle: The log bundle.
Return value
string 'any' => Full access. 'own' => Access to own logs. 'none' => No access to logs.
1 call to LogAutocompleteController::typeOfAccess()
- LogAutocompleteController::autocomplete in src/
Controller/ LogAutocompleteController.php - Retrieves suggestions for log name autocompletion.
File
- src/
Controller/ LogAutocompleteController.php, line 109
Class
- LogAutocompleteController
- Returns autocomplete responses for log names.
Namespace
Drupal\log\ControllerCode
protected function typeOfAccess(string $log_bundle) {
$account = $this
->currentUser();
if ($account
->hasPermission('administer log') || $account
->hasPermission('view any ' . $log_bundle . ' log')) {
return 'any';
}
if ($account
->hasPermission('view own ' . $log_bundle . ' log')) {
return 'own';
}
return 'none';
}