--- admin.module.2.0beta3 2010-05-18 13:08:18.000000000 +0200 +++ admin.module 2010-05-18 13:07:44.000000000 +0200 @@ -344,6 +344,7 @@ function admin_get_default_blocks($reset */ function admin_set_admin_blocks($reset = FALSE) { static $blocks; + global $user; if (!isset($blocks) || $reset) { $blocks = array(); if (user_access('use admin toolbar') && $enabled_blocks = admin_get_settings('blocks')) { @@ -358,6 +359,17 @@ function admin_set_admin_blocks($reset = $block->cache = is_numeric($cache) ? $cache : BLOCK_NO_CACHE; } if (!empty($block)) { + // Get role IDs which are the block is restricted to + $result = db_query("SELECT rid FROM {blocks_roles} WHERE module = '%s' AND delta = '%s'", $block->module, $block->delta); + $block_rids = array(); + while ($rid = db_result($result)) { + $block_rids[] = $rid; + } + // Don't display the block if it is restricted to role(s) and the current user does not belong to one of the roles + if (count($block_rids) > 0 AND count(array_intersect($block_rids, array_keys($user->roles))) == 0) { + continue; + } + if ($_SERVER['REQUEST_METHOD'] == 'GET' && $cid = admin_block_get_cache_id($block)) { if ($cache = cache_get($cid, 'cache_block')) { $array = $cache->data;