You are here

function block_access_user_access in Block Access 6.2

Same name and namespace in other branches
  1. 6 block_access.module \block_access_user_access()
  2. 7 block_access.module \block_access_user_access()
11 calls to block_access_user_access()
block_access_can_config in ./block_access.module
block_access_can_config_lang in ./block_access.module
block_access_can_config_page in ./block_access.module
block_access_can_config_role in ./block_access.module
block_access_can_config_spec in ./block_access.module

... See full list

File

./block_access.module, line 132

Code

function block_access_user_access($module, $delta, $perm) {
  global $user;
  static $perms = array();
  if (!isset($perms[$module])) {
    $perms[$module] = array(
      $delta => array(),
    );
  }
  if (!isset($perms[$module][$delta])) {
    $perms[$module][$delta] = array();
  }
  if (!isset($perms[$module][$delta][$perm])) {
    $perms[$module][$delta][$perm] = false;
    $roles = block_access_get_roles($module, $perm, $delta);
    foreach ($roles as $rid) {
      if (in_array($rid, array_keys($user->roles))) {
        $perms[$module][$delta][$perm] = true;
        break;
      }
    }
  }
  return $perms[$module][$delta][$perm];
}