public function SimpleAccessGroup::canManageAccess in Simple Access 8.3
Checks to see if the user has permission to use this role.
Parameters
$type_id: Node type which to check permissions.
\Drupal\Core\Session\AccountProxyInterface $account: Account to check the access.
Return value
bool Indicates if the account is able to access this group.
File
- src/
Entity/ SimpleAccessGroup.php, line 92
Class
- SimpleAccessGroup
- Defines the SimpleAccessGroup configuration entity class.
Namespace
Drupal\simple_access\EntityCode
public function canManageAccess($type_id, AccountProxyInterface $account = NULL) {
if (\Drupal::config('simple_access.settings')
->get('show_groups')) {
return TRUE;
}
if (!$account) {
/** @var \Drupal\Core\Session\AccountProxy $account */
$account = \Drupal::currentUser();
}
if ($this
->id() == 'owner') {
return $account
->hasPermission('assign owner permissions') || $account
->hasPermission("assign owner permissions for {$type_id}");
}
$roles = $account
->getRoles();
if (array_intersect($roles, $this->roles)) {
return $account
->hasPermission('assign groups to nodes') || $account
->hasPermission("assign groups to {$type_id} nodes");
}
return FALSE;
}