You are here

function domain_set_default_grant in Domain Access 7.2

Same name and namespace in other branches
  1. 5 domain.module \domain_set_default_grant()
  2. 6.2 domain.module \domain_set_default_grant()
  3. 7.3 domain.module \domain_set_default_grant()

Ensure that the 'domain_all' grant is present.

2 calls to domain_set_default_grant()
domain_enable in ./domain.module
Upon enabling this module, store the default view grant in the {node_access} table. Then it assigns all users to the primary domain.
_domain_store_grants in ./domain.module
Store node_access records in the {domain_access} table.

File

./domain.module, line 1829
Core module functions for the Domain Access suite.

Code

function domain_set_default_grant() {
  static $check = NULL;
  if (is_null($check)) {
    $check = (bool) db_query_range("SELECT 1 FROM {node_access} WHERE realm = :realm AND gid = :gid", 0, 1, array(
      ':realm' => 'domain_all',
      ':gid' => 0,
    ))
      ->fetchField();
    if (empty($check)) {
      db_insert('node_access')
        ->fields(array(
        'nid' => 0,
        'gid' => 0,
        'realm' => 'domain_all',
        'grant_view' => 1,
        'grant_update' => 0,
        'grant_delete' => 0,
      ))
        ->execute();
    }
  }
}