public function AdminPermissions::evaluate in Security Review 8
Returns the evaluation page of a result.
Usually this is a list of the findings and an explanation.
Parameters
\Drupal\security_review\CheckResult $result: The check result to evaluate.
Return value
array The render array of the evaluation page.
Overrides Check::evaluate
File
- src/
Checks/ AdminPermissions.php, line 81
Class
- AdminPermissions
- Checks whether untrusted roles have restricted permissions.
Namespace
Drupal\security_review\ChecksCode
public function evaluate(CheckResult $result) {
$output = [];
foreach ($result
->findings() as $rid => $permissions) {
$role = Role::load($rid);
/** @var Role $role */
$paragraphs = [];
$paragraphs[] = $this
->t("@role has the following restricted permissions:", [
'@role' => Link::createFromRoute($role
->label(), 'entity.user_role.edit_permissions_form', [
'user_role' => $role
->id(),
])
->toString(),
]);
$output[] = [
'#theme' => 'check_evaluation',
'#paragraphs' => $paragraphs,
'#items' => $permissions,
];
}
return $output;
}