You are here

function oa_access_node_insert in Open Atrium Core 7.2

Implements hook_node_insert().

File

modules/oa_access/oa_access.module, line 207
Code for the Open Atrium Access module.

Code

function oa_access_node_insert($node) {
  if ($node->type == 'oa_space') {

    // Find all permissions which are type OA_ACCESS_DEFAULT_OPTION_ALL and
    // OA_ACCESS_TEAM_PERMISSION and add the default 'All' option for those
    // new spaces.
    foreach (oa_access_get_permissions() as $name => $perm) {
      if ($perm['type'] & OA_ACCESS_TEAM_PERMISSION && ($perm['type'] & OA_ACCESS_TEAM_DEFAULT_OPTION_ALL) == OA_ACCESS_TEAM_DEFAULT_OPTION_ALL) {
        oa_access_initialize_permissions(array(
          $name => $perm,
        ), array(
          $node->nid,
        ));
      }
    }
  }
}