You are here

function view_unpublished_user_perms in view_unpublished 7

Utility function that returns the user's view_unpublished permissions in the following format:

$perms['any'] = TRUE if any of the below is TRUE, otherwise FALSE. $perms['full'] = TRUE if "view any unpublished content" is set. $perms['content_type'] = array of content types and the user's associated view unpublished permission.

1 call to view_unpublished_user_perms()
view_unpublished_query_node_access_alter in ./view_unpublished.module
Implements hook_query_TAG_alter();

File

./view_unpublished.module, line 223
Main functions and hook implementations of the View Unpublished module.

Code

function view_unpublished_user_perms() {
  $perms = FALSE;
  $perms['full'] = user_access('view any unpublished content') ? TRUE : FALSE;
  foreach (view_unpublished_content_type_permissions(TRUE) as $machine_type => $perm_type) {
    $perms['content_type'][$machine_type] = user_access($perm_type) ? TRUE : FALSE;
  }
  _vup_in_array_r(TRUE, $perms, TRUE) ? $perms['any'] = TRUE : ($perms['any'] = FALSE);
  return $perms;
}