You are here

function block_access_get_module in Block Access 7

Same name and namespace in other branches
  1. 6.2 block_access.db.inc \block_access_get_module()
  2. 6 block_access.db.inc \block_access_get_module()

get permissions for a given module

@returns an array of Role IDs and their permissions

Parameters

$module - the name of the module:

3 calls to block_access_get_module()
block_access_features_export in ./block_access.module
Implements hook_features_export().
block_access_features_export_render in ./block_access.module
Implements hook_features_export_render().
block_access_features_revert in ./block_access.module
Implements hook_features_revert().

File

./block_access.db.inc, line 87

Code

function block_access_get_module($module) {
  $query = db_select('block_access_roles', 'b')
    ->fields('b', array(
    'rid',
    'permission',
  ))
    ->condition('module', $module, '=')
    ->condition('delta', '', '=');
  $result = $query
    ->execute();
  $ret = array();
  while ($ob = $result
    ->fetchObject()) {
    if (isset($ret[$ob->rid])) {
      $ret[$ob->rid][] = $ob->permission;
    }
    else {
      $ret[$ob->rid] = array(
        $ob->permission,
      );
    }
  }
  return $ret;
}