You are here

function bat_unit_access_filter in Booking and Availability Management Tools for Drupal 7

Same name and namespace in other branches
  1. 8 modules/bat_unit/bat_unit.module \bat_unit_access_filter()

Filters units based on permissions for multiple values.

File

modules/bat_unit/bat_unit.module, line 615

Code

function bat_unit_access_filter($op, $units = array(), $account = NULL) {
  $filtered_units = array();

  // If no user object is supplied, the access check is for the current user.
  if (empty($account)) {
    $account = $GLOBALS['user'];
  }
  foreach ($units as $key => $unit) {
    if (bat_unit_access($op, $unit, $account)) {
      $filtered_units[$key] = $unit;
    }
  }
  return $filtered_units;
}