function _module_grants_test_add_view_all in Module Grants 7
Add view all records
4 calls to _module_grants_test_add_view_all()
- ModuleGrantsEntityTestCase::testNodeViewAllAccess in module_grants_entity/
module_grants_entity.test - ModuleGrantsEntityTestCase::testViewAllNodesFunction in module_grants_entity/
module_grants_entity.test - ModuleGrantsViewOpTestCase::doViewOpTestWithModuleGrantsOff in ./
module_grants.test - ModuleGrantsViewOpTestCase::testViewOpWithModuleGrantsOnAndViewAll in ./
module_grants.test
File
- tests/
module_grants_test_base.module, line 71 - All dummy modules will assign grants based on whether node's title containing a particular keyword and user's permission. All function takes $grants, which is an array keyed by realm, and value is another array of keyword => gid, keyword…
Code
function _module_grants_test_add_view_all($grants, $view_all_gid) {
foreach ($grants as $realm => $gids) {
$record = array(
'nid' => 0,
'gid' => $view_all_gid,
'realm' => $realm,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
);
drupal_write_record('node_access', $record);
}
}