public function execute() { if (!$this->getUser()->getRights('shop', 'settings')) { throw new waRightsException(_w('Access denied')); } $feature_id = waRequest::post('feature_id'); if ($feature_id) { $model = new shopFeatureModel(); $model->delete($feature_id); } }
public function execute() { if (!$this->getRights('settings')) { throw new waAPIException('access_denied', 403); } $feature_model = new shopFeatureModel(); if ($id = $this->post('id')) { $feature = $feature_model->getById($id); } elseif ($code = $this->post('code')) { $feature = $feature_model->getByCode($code); } else { throw new waAPIException('invalid_param', 'Required parameter is missing: id or code', 400); } if (!$feature) { throw new waAPIException('invalid_param', 'Feature not found', 404); } $this->response = (bool) $feature_model->delete($feature['id']); }