You are here

public function uc_addresses_views_access::access in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 views/uc_addresses_views_access.inc \uc_addresses_views_access::access()

Implements views_plugin_access#access().

Overrides views_plugin_access::access

File

views/uc_addresses_views_access.inc, line 129
Contains uc_addresses_views_access class.

Class

uc_addresses_views_access
Access plugin that provides access control based on custom PHP code.

Code

public function access($account) {
  $args = $this->view->args;
  if (count($args) < 1) {

    // Not enough information. Deny access.
    return FALSE;
  }

  // Pick placeholder path.
  $path = implode('/', array_fill(1, count($args), '%'));
  $positions = $this
    ->uc_addresses_find_arg_positions($path);
  $uid = NULL;
  $aid = NULL;
  if (isset($args[$positions['uid']])) {
    $uid = $args[$positions['uid']];
  }
  if (isset($args[$positions['aid']])) {
    $aid = $args[$positions['aid']];
  }
  return uc_addresses_check_access_by_ids($this->options['access_type'], $uid, $aid, $account);
}