You are here

public static function UcAddressesPermissions::canEditAddress in Ubercart Addresses 6.2

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

Check if the user can edit addresses of this user.

@access public @static

Parameters

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 the given user has permission to edit the address. FALSE otherwise.

7 calls to UcAddressesPermissions::canEditAddress()
uc_addresses_address_book in ./uc_addresses.pages.inc
Generates a list of all addresses owned by a single user.
uc_addresses_check_access_by_ids in ./uc_addresses.module
Checks address access by ID's.
uc_addresses_handler_field_uc_addresses_link_edit::uc_addresses_render_link in views/uc_addresses_handler_field_uc_addresses_link_edit.inc
Renders the link if the user may edit the address.
uc_addresses_handler_filter_access::check_access in views/uc_addresses_handler_filter_access.inc
Checks address access for the current user.
uc_addresses_render_link in ./uc_addresses.pages.inc
Renders a link to an address if the user has access to the given operation of the address.

... See full list

File

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

Class

UcAddressesPermissions
The permission class: UcAddressesPermissions.

Code

public static function canEditAddress($address_user, UcAddressesAddress $address = NULL, $account = NULL) {
  $account = self::getAccount($account);
  if ($address_user->uid == $account->uid && self::canEditOwn($account)) {

    // Ask other modules if the address may be edited.
    return self::invoke('uc_addresses_may_edit', $address_user, $address, $account);
  }
  if ($address_user->uid != $account->uid && self::canEditAll($account)) {

    // Ask other modules if the address may be edited.
    return self::invoke('uc_addresses_may_edit', $address_user, $address, $account);
  }

  // No other cases are permitted.
  return FALSE;
}