function _panels_pane_access_role in Panels 6.2
Same name and namespace in other branches
- 5.2 includes/plugins.inc \_panels_pane_access_role()
Determine role-based access to a panel pane for the current user
Parameters
object $pane: The pane object to test.
object $account: The current $user object.
Return value
bool $role_access The boolean result of the roles-based segment of the Panels access system.
Related topics
1 call to _panels_pane_access_role()
- panels_pane_access in includes/
plugins.inc - Master pane access function; combines all the relevant parameters that natively used by the Panels API to determine a pane's access. Called from panels_render_panes().
File
- includes/
plugins.inc, line 196 - plugins.inc
Code
function _panels_pane_access_role($pane, $account) {
// All views with an empty access setting are available to all roles.
if (!$pane->access || !is_array($pane->access)) {
return TRUE;
}
// Otherwise, check roles
static $roles = array();
if (!isset($roles[$account->uid])) {
$roles[$account->uid] = array_keys($account->roles);
$roles[$account->uid][] = $account->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID;
}
return array_intersect($pane->access, $roles[$account->uid]) ? TRUE : FALSE;
}