Jump to content

Shop-for-processWire - Manage who has access to which modules


nghi
 Share

Recommended Posts

Oh figure it out =D!

I added the permission in the installer and uninstaller function. Then on my client role I gave it the shop_orders permission. (You can also do it manually in the back end)

public function install() {

$permission = $this->permissions->get('shop_orders');
 if (!$permission->id) {
  $p = new Permission();
  $p->name = 'shop_orders';
  $p->title = $this->_('view Order mangement');
  $p->save();
 }
}

public function uninstall() {
 $permission = $this->permissions->get('shop_orders');
 if ($permission->id) {
  $permission->delete();
 }
}

//Also needed to modified this line and added check_access
$orders = $this->pages->find('template=sc-order,limit=20,sort=-created, check_access=0');

I didn't realize that you can set permission in modules in the getModuleInfo()

public static function getModuleInfo() { return array(
  'title' => 'Orders Management',
  'summary' => 'Manage Shop orders',
  'version' => 002,
  'permanent' => false,
  'singular' => true,
  'permission' => 'shop_orders', <-------
  'requires' => array(
   "ShoppingCart",
   "ShoppingCheckout"
  )
 );} 
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...