getQueryParams(); /** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager */ $authorizer = $this->ci->authorizer; /** @var \UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface $currentUser */ $currentUser = $this->ci->currentUser; // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'uri_jobs')) { throw new ForbiddenException(); } /** @var \UserFrosting\Sprinkle\Jobs\JobInspector $jobInspector */ $jobInspector = $this->ci->jobInspector; $jobs = $jobInspector->getAvailableJobDefinitions(); // Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content. // For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating). return $response->withJson($jobs, 200, JSON_PRETTY_PRINT); } /** * Renders the job listing page. * * This page renders a table of jobs, with dropdown menus for admin actions for each job. * Actions typically include: run job * This page requires authentication. * * Request type: GET * * @param Request $request * @param Response $response * @param array $args * * @throws ForbiddenException If user is not authorized to access page */ public function pageList(Request $request, Response $response, $args) { /** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager */ $authorizer = $this->ci->authorizer; /** @var \UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface $currentUser */ $currentUser = $this->ci->currentUser; // Access-controlled page if (!$authorizer->checkAccess($currentUser, 'uri_jobs')) { throw new ForbiddenException(); } /** @var \UserFrosting\Sprinkle\Jobs\JobInspector $jobInspector */ $jobInspector = $this->ci->jobInspector; $jobs = $jobInspector->getAvailableJobDefinitions(); return $this->ci->view->render($response, 'pages/jobs.html.twig', [ 'jobs' => $jobs ]); } }