canvasRepo = $canvasRepo; $this->goalService = $goalService; } /** * Displays the delete goal canvas confirmation. * * @param array $params Request parameters */ #[RequiresPermission(GoalcanvasPermissions::DELETE)] public function get(array $params): Response { $id = (int) ($params['id'] ?? $_GET['id'] ?? 0); $this->tpl->assign('id', $id); return $this->tpl->displayPartial(static::CANVAS_NAME.'canvas.delCanvas'); } /** * Handles goal canvas board deletion. * * @param array $params Request parameters */ #[RequiresPermission(GoalcanvasPermissions::DELETE, entityScoped: true)] public function post(array $params): Response { $id = (int) ($params['id'] ?? $_GET['id'] ?? 0); if (isset($_POST['del']) && $id > 0) { // The service resolves the board's REAL project and authorizes DELETE against it // (throwing for a missing/foreign board) — closing the by-id board-delete IDOR the // previous role-only Auth::authOrRedirect left open. $this->goalService->deleteGoalBoard($id); $allCanvas = $this->canvasRepo->getAllCanvas(session('currentProject')); session(['current'.strtoupper(static::CANVAS_NAME).'Canvas' => $allCanvas[0]['id'] ?? -1]); $this->tpl->setNotification($this->language->__('notification.board_deleted'), 'success', strtoupper(static::CANVAS_NAME).'canvas_deleted'); if (! $allCanvas) { return Frontcontroller::redirect(BASE_URL.'/blueprints/showBoards'); } return Frontcontroller::redirect(BASE_URL.'/'.static::CANVAS_NAME.'canvas/showCanvas'); } $this->tpl->assign('id', $id); return $this->tpl->displayPartial(static::CANVAS_NAME.'canvas.delCanvas'); } }