/** * Akce pro smazání konkrétního rulesetu * @param int $id */ public function actionDelete($id) { //najití RuleSetu a kontroly $ruleSet = $this->ruleSetsFacade->findRuleSet($id); $this->ruleSetsFacade->checkRuleSetAccess($ruleSet, $this->user->id); //smazání if ($this->ruleSetsFacade->deleteRuleSet($ruleSet)) { $this->sendJsonResponse(['state' => 'ok']); } }
/** * Akce pro smazání zvoleného rule setu * @param int $id * @throws \Nette\Application\BadRequestException * @SWG\Delete( * tags={"RuleSets"}, * path="/rule-sets/{id}", * summary="Remove rule set", * security={{"apiKey":{}},{"apiKeyHeader":{}}}, * produces={"application/json","application/xml"}, * @SWG\Parameter( * name="id", * description="RuleSet ID", * required=true, * type="integer", * in="path" * ), * @SWG\Response( * response=200, * description="Rule set deleted successfully.", * @SWG\Schema(ref="#/definitions/StatusResponse") * ), * @SWG\Response(response=404, description="Requested rule set was not found.") * ) */ public function actionDelete($id) { /** @var RuleSet $ruleSet */ $ruleSet = $this->findRuleSetWithCheckAccess($id); //smazání if ($this->ruleSetsFacade->deleteRuleSet($ruleSet)) { $this->resource = ['code' => 200, 'status' => 'OK']; } else { throw new BadRequestException(); } $this->sendResource(); }