You are here

private static function UcAddressesPermissions::invoke in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 class/UcAddressesPermissions.class.php \UcAddressesPermissions::invoke()

Ask other modules if a particular operation is permitted.

@access private @static

Parameters

string $hook: The hook to invoke.

object $address_user: The owner of the address.

UcAddressesAddress: (optional) The address object.

object $account: (optional) The account to check access for. Defaults to the current active user.

Return value

boolean TRUE if all modules agree that the operation is permitted. FALSE otherwise.

3 calls to UcAddressesPermissions::invoke()
UcAddressesPermissions::canDeleteAddress in class/UcAddressesPermissions.class.php
Check if the user can delete addresses of this user. Default addresses can never be deleted.
UcAddressesPermissions::canEditAddress in class/UcAddressesPermissions.class.php
Check if the user can edit addresses of this user.
UcAddressesPermissions::canViewAddress in class/UcAddressesPermissions.class.php
Check if user may view this address.

File

class/UcAddressesPermissions.class.php, line 441
Permission class.

Class

UcAddressesPermissions
The permission class: UcAddressesPermissions.

Code

private static function invoke($hook, $address_user, UcAddressesAddress $address = NULL, $account = NULL) {
  $account = self::getAccount($account);
  if ($account->uid != 1) {

    // Ask other modules if the operation on the address is permitted.
    // If one of the modules returns FALSE, then the operation on the address is not permitted.
    // The superuser (user 1) may do everything, for this user the check is bypassed.
    foreach (module_implements($hook) as $module) {
      $function = $module . '_' . $hook;
      if (!$function($address_user, $address, $account)) {
        return FALSE;
      }
    }
  }
  return TRUE;
}