You are here

function security_review_check_views_access in Security Review 7

Same name and namespace in other branches
  1. 6 security_review.inc \security_review_check_views_access()
1 string reference to 'security_review_check_views_access'
views_security_checks in ./security_review.inc
Checks for security_review_get_checklist() when Views is enabled.

File

./security_review.inc, line 751
Stand-alone security checks and review system.

Code

function security_review_check_views_access($last_check = NULL) {
  $result = TRUE;
  $check_result_value = array();
  $timestamp = NULL;

  // Load and loop through every view, checking the access type in displays.
  $views = views_get_all_views();
  foreach ($views as $view) {
    if ($view->disabled !== TRUE) {

      // 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 array(
    'result' => $result,
    'value' => $check_result_value,
  );
}