protected function _getCommercialGroup() { try { $id = $this->_getNumericId(); } catch (\Application\Exceptions\ValidateException $e) { throw new \Application\Exceptions\ValidateException('Invalid parameter value: id. Supported values are valid commercial group IDs'); } $commercialGroup = $this->_cgSrv->load($id); $this->_helper->allowed('read', $commercialGroup); return $commercialGroup; }
/** * Deletes the given commercial group */ public function deleteAction() { $commGroupId = $this->getRequest()->getParam('id'); $commGroup = $this->_cgSrv->load($commGroupId); if (empty($commGroup)) { throw new NotFoundException('CommercialGroup ' . $commGroupId . ' not found', 404); } // Check permissions $this->_helper->allowed('delete', $commGroup); // Remove the user $this->_cgSrv->delete($commGroup); $this->view->data = true; }
public function poolsAction() { if (!$this->getRequest()->isGet()) { throw new AppEx\UnexpectedException("Resquest must be GET"); } $id = $this->_getParam('id', null); if (!isset($id) && !strlen($id)) { throw new AppEx\InvalidArgumentException('You must indicate a commercial group id'); } $commercialGroup = $this->_cgSrv->load($id); if (empty($commercialGroup)) { throw new NotFoundException("Commercial Group {$id} not found", 404); } // Check permissions $this->_helper->allowed('read', $commercialGroup); $pools = $this->_cgSrv->getPools($id); //check permissions for pools if ($pools) { $this->_helper->filterNotAllowedFields('read_field', $pools); } // Response with the list of pools $this->view->data = $pools; }