You are here

public function SecurityReviewController::defaultUntrustedRoles in Acquia Connector 3.x

Same name and namespace in other branches
  1. 8.2 src/Controller/SecurityReviewController.php \Drupal\acquia_connector\Controller\SecurityReviewController::defaultUntrustedRoles()
  2. 8 src/Controller/SecurityReviewController.php \Drupal\acquia_connector\Controller\SecurityReviewController::defaultUntrustedRoles()

Helper function defines the default untrusted Drupal roles.

1 call to SecurityReviewController::defaultUntrustedRoles()
SecurityReviewController::untrustedRoles in src/Controller/SecurityReviewController.php
Helper function for user-defined or default untrusted Drupal roles.

File

src/Controller/SecurityReviewController.php, line 609

Class

SecurityReviewController
Acquia Security Review page.

Namespace

Drupal\acquia_connector\Controller

Code

public function defaultUntrustedRoles() {
  $roles = [
    AccountInterface::ANONYMOUS_ROLE => 'anonymous user',
  ];

  // Need set default value.
  $user_register = \Drupal::config('user.settings')
    ->get('register');

  // If visitors are allowed to create accounts they are considered untrusted.
  if ($user_register != UserInterface::REGISTER_ADMINISTRATORS_ONLY) {
    $roles[AccountInterface::AUTHENTICATED_ROLE] = 'authenticated user';
  }
  return $roles;
}