function mobile_tools_views_check_access in Mobile Tools 6.3
Same name and namespace in other branches
- 6.2 mobile_tools.module \mobile_tools_views_check_access()
Views access check as used by the mobile access check for views
1 call to mobile_tools_views_check_access()
- mobile_tools_plugin_access_mobile::access in views/
plugins/ mobile_tools_plugin_access_mobile.inc - Check access directly.
1 string reference to 'mobile_tools_views_check_access'
File
- ./
mobile_tools.module, line 861 - Mobile Tools provides a range of functionality assisting in creating a mobile Drupal site . this functionality contains:
Code
function mobile_tools_views_check_access($device, $perms, $rids) {
global $user;
// first check device permission
$current_device = mobile_tools_site_type();
// general case of mobile site
if ($device[$current_device]) {
$access = TRUE;
}
else {
return FALSE;
}
// Additional check
if (!empty($perms)) {
foreach ($perms as $perm) {
$access = $access && user_access($perm);
}
}
$account = isset($account) ? $account : $user;
$roles = array_keys($account->roles);
$roles[] = $account->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID;
if ($rids) {
$access = $access && (user_access('access all views', $account) || array_intersect(array_filter($rids), $roles));
}
return $access;
}