You are here

function security_review_check_views_access_help in Security Review 7

Same name and namespace in other branches
  1. 6 security_review.help.inc \security_review_check_views_access_help()

File

./security_review.help.inc, line 310
Main help definition.

Code

function security_review_check_views_access_help($check = NULL, $skipped_message = NULL) {
  $element['title'] = t('Views access');
  $element['descriptions'][] = t("Views can check if the user is allowed access to the content. It is recommended that all Views implement some amount of access control, at a minimum checking for the permission 'access content'.");
  if (!empty($skipped_message)) {
    $element['findings']['descriptions'][] = $skipped_message;
  }
  elseif ($check && $check['result'] == FALSE) {
    $element['findings']['descriptions'][] = t('The following View displays do not check access.');
    foreach ($check['value'] as $view => $displays) {
      $url = 'admin/structure/views/view/' . $view . '/edit/';
      foreach ($displays as $display) {
        $item = $view . ': ' . $display;
        $element['findings']['items'][] = array(
          'html' => l($item, $url . $display),
          'safe' => $item,
          // View names are safe.
          'raw' => $item,
        );
      }
    }
  }
  return $element;
}