public function user::mayEditEntity in Fasttoggle 8.2
Access.
Parameters
&$elements: The render array, to which caching info should be added.
Return value
AccessResult AccessResult (cacheability info and the outcome).
Overrides AbstractSettingObject::mayEditEntity
File
- src/
Plugin/ SettingObject/ user.php, line 73 - Fasttoggle Managed Node
Class
- user
- Class for managing users.
Namespace
Drupal\fasttoggle\Plugin\SettingObjectCode
public function mayEditEntity() {
$user = \Drupal::currentUser();
if ($this->object
->id() == 1) {
$config = FasttoggleController::getConfig();
$result = AccessResult::allowedIf($config
->get('user_allow_block_user1'))
->addCacheableDependency($this->object);
$cacheability = new CacheableMetadata();
$cacheability
->setCacheTags([
'user_allow_block_user1',
]);
$result
->addCacheableDependency($cacheability);
return $result;
}
return AccessResult::allowedIf($user
->hasPermission('administer users'))
->cachePerUser();
}