function commerce_cardonfile_data_access in Commerce Card on File 7
Determines if the current user has access to perform an operation on the given card data array.
1 string reference to 'commerce_cardonfile_data_access'
- commerce_cardonfile_menu in ./
commerce_cardonfile.module - Implements hook_menu().
File
- ./
commerce_cardonfile.module, line 104 - Supports card on file functionality for credit card payment methods by associating card data reference IDs from payment gateways with user accounts.
Code
function commerce_cardonfile_data_access($card_data) {
global $user;
// Grant access for any user with administer permission.
if (user_access('administer card data')) {
return TRUE;
}
// Grant access for users with permission to manage their own card data.
if ($user->uid && user_access('manage own card data') && $user->uid == $card_data['uid']) {
return TRUE;
}
return FALSE;
}