Created
November 3, 2014 20:33
-
-
Save dbarbar/e3bae08c2c78347ee1a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
cache_clear_all(); | |
ctools_include('export'); | |
$displays = array('default', 'block', 'page'); | |
$views = array('sbv_notes', 'sbv_administrators'); | |
$anon = user_load(0); | |
$admin = user_load(1); | |
foreach ($views as $view_name) { | |
$view = ctools_export_crud_load('views_view', $view_name); | |
$placeholders = array('%view_name' => $view_name); | |
if ($view->access($displays, $anon)) { | |
drupal_set_message(t('The anonymous user can access the %view_name View. Please add access control to it in the Views UI.', $placeholders)); | |
} | |
else { | |
drupal_set_message(t('The %view_name View is correctly restricted from anonymous users', $placeholders)); | |
} | |
if (!$view->access($displays, $admin)) { | |
drupal_set_message(t('The admin user cannot access the %view_name View. Please adjust access control to it in the Views UI.', $placeholders)); | |
} | |
else { | |
drupal_set_message(t('The %view_name View is correctly allowed for the admin user', $placeholders)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment