You are here

function security_review_check_views_access in Security Review 6

Same name and namespace in other branches
  1. 7 security_review.inc \security_review_check_views_access()
1 call to security_review_check_views_access()
security_review_check_views_access_help in ./security_review.help.inc
1 string reference to 'security_review_check_views_access'
_views_security_checks in ./security_review.inc
Checks for security_review_get_checks() when Views is enabled.

File

./security_review.inc, line 677
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,
  );
}