You are here

function party_hat_party_access in Party 7

Same name and namespace in other branches
  1. 8.2 modules/party_hat/party_hat.module \party_hat_party_access()

Implements hook_party_access().

File

modules/party_hat/party_hat.party.inc, line 10
Party general hook include.

Code

function party_hat_party_access($op, $party = NULL, $data_set = NULL, $account = NULL) {

  // We say nothing about access to just the party.
  if (!isset($data_set)) {
    return NULL;
  }
  switch ($op) {

    // View, attach, and add ops are the same: you can't view a party's data set
    // if you can't have it attached either.
    case 'attach':
    case 'add':
    case 'view':
      $data_set_name = $data_set['set_name'];
      $sets = party_get_party_data_sets($party);

      // If any hat has the data set, grant access.
      if (!in_array($data_set_name, $sets)) {
        return FALSE;
      }
  }
}