You are here

function commerce_coupon_user_permission in Commerce Coupon 7.2

Implements hook_permission().

File

modules/user/commerce_coupon_user.module, line 11
Provides coupon-to-user relationship for Commerce Coupon.

Code

function commerce_coupon_user_permission() {
  $permissions = array();

  // Add "own" type permissions for all coupon types.
  foreach (commerce_coupon_get_types() as $type => $info) {
    $permissions['redeem received coupons of type ' . $type] = array(
      'title' => t('Redeem received %type coupon', array(
        '%type' => $info['label'],
      )),
    );
    $permissions['redeem non user specific coupons of type ' . $type] = array(
      'title' => t('Redeem non-user-specific %type coupon', array(
        '%type' => $info['label'],
      )),
    );
    $permissions['view received coupons of type ' . $type] = array(
      'title' => t('View received %type coupon', array(
        '%type' => $info['label'],
      )),
    );
    $permissions['view non user specific coupons of type ' . $type] = array(
      'title' => t('View non-user-specific %type coupon', array(
        '%type' => $info['label'],
      )),
    );
  }
  return $permissions;
}