You are here

function uc_product_perm in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_product/uc_product.module \uc_product_perm()

Implementation of hook_perm().

File

uc_product/uc_product.module, line 189
The product module for Ubercart.

Code

function uc_product_perm() {
  $perms = array(
    'administer products',
    'administer product classes',
    'administer product features',
  );
  foreach (node_get_types() as $type) {
    if ($type->module == 'uc_product') {
      $name = check_plain($type->type);
      if ($name == 'product') {
        $name = '';
      }
      else {
        $name .= ' ';
      }
      $perms[] = 'create ' . $name . 'products';
      $perms[] = 'edit own ' . $name . 'products';
      $perms[] = 'edit ' . $name . 'products';
    }
  }
  return $perms;
}