コード例 #1
0
 /**
  * Create permissions for Wishlist resource.
  *
  * @param Permission $parentPermission
  * @return Permission
  */
 private function createWishlistPermissions(Permission $parentPermission)
 {
     // Create main permissions node
     $managePermission = new Permission();
     $managePermission->setCode('webburza.manage.wishlist');
     $managePermission->setDescription('Manage wishlists');
     $managePermission->setParent($parentPermission);
     // Define permissions
     $permissions = ['webburza.wishlist.show' => 'Show wishlist', 'webburza.wishlist.index' => 'List wishlists', 'webburza.wishlist.create' => 'Create wishlist', 'webburza.wishlist.update' => 'Update wishlist', 'webburza.wishlist.delete' => 'Delete wishlist'];
     // Create each permission
     foreach ($permissions as $code => $description) {
         $permission = new Permission();
         $permission->setCode($code);
         $permission->setDescription($description);
         $managePermission->addChild($permission);
     }
     return $managePermission;
 }
コード例 #2
0
 /**
  * Create permissions for Location Type resource.
  *
  * @param PermissionInterface $parentPermission
  *
  * @return PermissionInterface
  */
 private function createLocationTypePermissions(PermissionInterface $parentPermission)
 {
     // Create main permissions node
     $managePermission = new Permission();
     $managePermission->setCode('webburza_location.manage.location_type');
     $managePermission->setDescription('Manage location types');
     $managePermission->setParent($parentPermission);
     // Define permissions
     $permissions = ['webburza_location.location_type.show' => 'Show location type', 'webburza_location.location_type.index' => 'List location types', 'webburza_location.location_type.create' => 'Create location type', 'webburza_location.location_type.update' => 'Update location type', 'webburza_location.location_type.delete' => 'Delete location type'];
     // Create each permission
     foreach ($permissions as $code => $description) {
         $permission = new Permission();
         $permission->setCode($code);
         $permission->setDescription($description);
         $managePermission->addChild($permission);
     }
     return $managePermission;
 }
コード例 #3
0
 /**
  * Create permissions for Article Category resource.
  *
  * @param Permission $parentPermission
  * @return Permission
  */
 private function createArticleCategoryPermissions(Permission $parentPermission)
 {
     // Create main permissions node
     $managePermission = new Permission();
     $managePermission->setCode('webburza.manage.article_category');
     $managePermission->setDescription('Manage article categories');
     $managePermission->setParent($parentPermission);
     // Define permissions
     $permissions = ['webburza.article_category.show' => 'Show article category', 'webburza.article_category.index' => 'List article categories', 'webburza.article_category.create' => 'Create article category', 'webburza.article_category.update' => 'Update article category', 'webburza.article_category.delete' => 'Delete article category'];
     // Create each permission
     foreach ($permissions as $code => $description) {
         $permission = new Permission();
         $permission->setCode($code);
         $permission->setDescription($description);
         $managePermission->addChild($permission);
     }
     return $managePermission;
 }