You are here

private function SecurityReviewController::checkViewsAccess in Acquia Connector 8

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

Check views access.

Parameters

int|null $last_check: Timestamp.

Return value

array Result.

File

src/Controller/SecurityReviewController.php, line 284

Class

SecurityReviewController
Acquia Security Review page.

Namespace

Drupal\acquia_connector\Controller

Code

private function checkViewsAccess($last_check = NULL) {
  $result = TRUE;
  $check_result_value = [];

  // Need review.
  $views = Views::getEnabledViews();
  foreach ($views as $view) {
    $view_name = $view
      ->get('originalId');
    $view_display = $view
      ->get('display');

    // Access is set in display options of a display.
    foreach ($view_display as $display_name => $display) {
      if (isset($display['display_options']['access']) && $display['display_options']['access']['type'] == 'none') {
        $check_result_value[$view_name][] = $display_name;
      }
    }
  }
  if (!empty($check_result_value)) {
    $result = FALSE;
  }
  return [
    'result' => $result,
    'value' => $check_result_value,
  ];
}