You are here

public function AdminPermissions::evaluatePlain in Security Review 8

Evaluates a CheckResult and returns a plaintext output.

Parameters

\Drupal\security_review\CheckResult $result: The check result to evaluate.

Return value

string The evaluation string.

Overrides Check::evaluatePlain

File

src/Checks/AdminPermissions.php, line 112

Class

AdminPermissions
Checks whether untrusted roles have restricted permissions.

Namespace

Drupal\security_review\Checks

Code

public function evaluatePlain(CheckResult $result) {
  $output = '';
  foreach ($result
    ->findings() as $rid => $permissions) {
    $role = Role::load($rid);

    /** @var Role $role */
    $output .= $this
      ->t('@role has @permissions', [
      '@role' => $role
        ->label(),
      '@permissions' => implode(', ', $permissions),
    ]);
    $output .= "\n";
  }
  return $output;
}