1 views.module views_check_perm($perms, $account = NULL)

Access callback for the views_plugin_access_perm access plugin.

Determine if the specified user has access to a view on the basis of permissions. If the $account argument is omitted, the current user is used.


core/modules/views/views.module, line 865
Primarily Backdrop hooks and global API functions to manipulate views.


function views_check_perm($perms, $account = NULL) {
  // Backward compatibility to ensure also a single permission string is
  // properly processed.
  $perms = is_array($perms) ? $perms : array($perms);
  if (user_access('access all views', $account)) {
    return TRUE;
  // Perms are handled as OR; as soon one permission allows access, TRUE is
  // returned.
  foreach ($perms as $perm) {
    if (user_access($perm, $account)) {
      return TRUE;
  return FALSE;