function block_access_get_roles in Block Access 6
Same name and namespace in other branches
- 6.2 block_access.db.inc \block_access_get_roles()
- 7 block_access.db.inc \block_access_get_roles()
2 calls to block_access_get_roles()
File
- ./
block_access.db.inc, line 43
Code
function block_access_get_roles($module, $perm, $delta = null) {
$sql = "\n SELECT rid\n FROM {block_access_roles}\n WHERE module = '%s'\n AND permission = '%s'\n ";
$args = array(
$module,
$perm,
);
if ($delta) {
$sql2 = $sql;
$sql .= "AND delta = '%s'";
$args[] = $delta;
}
$result = db_query($sql, $args);
$ret = array();
while ($rid = db_result($result)) {
$ret[] = $rid;
}
// If we didn't find any for the delta, use the module defaults
if ($delta && empty($ret)) {
$result = db_query($sql2, $module, $perm);
while ($rid = db_result($result)) {
$ret[] = $rid;
}
}
return $ret;
}