You are here

function og_node_grants in Organic groups 5.2

File

./og.module, line 1955

Code

function og_node_grants($account, $op) {
  if (variable_get('og_enabled', FALSE)) {
    if ($op == 'view') {
      $grants['og_public'][] = 0;

      // everyone can see a public node
    }

    // get subscriptions
    if ($subscriptions = og_get_subscriptions($account->uid)) {
      foreach ($subscriptions as $key => $val) {
        if ($op == 'view') {
          $grants['og_subscriber'][] = $key;
        }
        if (($op == 'update' || $op == 'delete') && $val['is_admin']) {
          $grants['og_subscriber'][] = $key;
        }
      }
    }
    return $grants ? $grants : array();
  }
}