You are here

function module_grants_is_realm_by_module in Module Grants 7

Check if realm belongs to module, copied from module_access

2 calls to module_grants_is_realm_by_module()
module_grants_by_module in ./module_grants.module
Return a map, keyed by module name, of grant arrays (keys are realms, values are array of grants) associated with the module, as returned by that module's hook_node_grants().
module_grants_get_node_access_realms_for_module in ./module_grants.module
Check if a module has node_access record for a node or for access all This is used in lenient mode, where if there's no node_access record from a module, then we skip the access checking for this module.

File

./module_grants.module, line 449

Code

function module_grants_is_realm_by_module($realm, $module) {
  $realm_functions =& drupal_static(__FUNCTION__);
  if (!isset($realm_functions)) {
    $realm_functions = array();
    $access_modules = module_implements('node_grants');

    // register realm identification function per module
    foreach ($access_modules as $module_name) {
      $realm_functions[$module_name] = function ($realm) use ($module_name) {
        return _modules_grants_prefix_match($module_name, $realm);
      };
    }

    // call the custom hook to register realm identification functions
    drupal_alter('module_grants_realm_function_register', $realm_functions);
  }
  return isset($realm_functions[$module]) ? $realm_functions[$module]($realm) : false;
}