function views_access

3.x views.module views_access()
2.x views.module views_access()

Determine if the logged in user has access to a view.

This function should only be called from a menu hook or some other embedded source. Each argument is the result of a call to views_plugin_access::get_access_callback() which is then used to determine if that display is accessible. If *any* argument is accessible, then the view is accessible.

1 string reference to 'views_access'
views_plugin_display_page::execute_hook_menu in plugins/views_plugin_display_page.inc
Add this display's path information to Drupal's menu system.

File

./views.module, line 461
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_access() {
  $args = func_get_args();
  foreach ($args as $arg) {
    if ($arg === TRUE) {
      return TRUE;
    }

    if (!is_array($arg)) {
      continue;
    }

    list($callback, $arguments) = $arg;
    $arguments = $arguments ? $arguments : array();
    if (function_exists($callback) && call_user_func_array($callback, $arguments)) {
      return TRUE;
    }
  }

  return FALSE;
}