ヤミRoot VoidGate
User / IP
:
216.73.216.137
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
api
/
src
/
AppBundle
/
Controller
/
Api
/
Viewing: CabController.php
<?php namespace AppBundle\Controller\Api; use FOS\RestBundle\Controller\FOSRestController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use FOS\RestBundle\Request\ParamFetcher; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Nelmio\ApiDocBundle\Annotation as Doc; use FOS\RestBundle\Controller\Annotations as Rest; use AppBundle\Entity\Cab; use AppBundle\Entity\Company; use AppBundle\Form\CabType; /** * Cab controller. * */ class CabController extends FOSRestController { /** * Creates a new cab entity. * * @Rest\Post( * path = "/companies/{companyId}/cabs", * requirements = { "companyId" = "\d+"} * ) * @Rest\View( * SerializerGroups = {"CAB_DETAILS", "LIST"} * ) * @Security("has_role('ROLE_COMPANY_ADMIN')") * @Doc\ApiDoc( * section="Cabs", * resource=true, * description="Creates a new Cab entity.", * input = { * "class" = "AppBundle\Form\CabType" * }, * statusCodes={ * Response::HTTP_OK = "Successful", * Response::HTTP_FORBIDDEN = "Access denied", * Response::HTTP_BAD_REQUEST = "Bad request" * } * ) */ public function newAction(Request $request, Company $company) { $cab = new Cab(); $form = $this->createForm(CabType::class, $cab); $form->submit($request->request->all(), false); $listErrors = $this->get('validator')->validate($cab); if (count($listErrors)) { // TODO: format $listError to be used directly in exceptions // throw new BadRequestHttpException($listErrors); return $this->view($listErrors, Response::HTTP_BAD_REQUEST); } $cab = $this->get('cab_manager')->createCab($cab, $company); return $cab; } /** * Edit an existing cab entity. * * @Rest\Put( * path = "/cabs/{cabId}", * requirements = { "cabId" = "\d+"} * ) * @Rest\View( * SerializerGroups = {"CAB_DETAILS", "LIST"} * ) * @Security("has_role('ROLE_COMPANY_ADMIN')") * @Doc\ApiDoc( * section="Cabs", * resource=true, * description="Edit an existing cab entity.", * input = { * "class" = "AppBundle\Form\CabType" * }, * statusCodes={ * Response::HTTP_OK = "Successful", * Response::HTTP_FORBIDDEN = "Access denied", * Response::HTTP_BAD_REQUEST = "Bad request" * } * ) */ public function updateAction(Request $request, Cab $cab) { $form = $this->createForm(CabType::class, $cab); $form->submit($request->request->all(), false); $listErrors = $this->get('validator')->validate($cab); if (count($listErrors)) { // TODO: format $listError to be used directly in exceptions // throw new BadRequestHttpException($listErrors); } $cab = $this->get('cab_manager')->updateCab($cab); return $cab; } /** * Deletes a cab entity. * * @Rest\Delete( * path="/cabs/{cabId}", * requirements={ "cabId" = "\d+"} * ) * @Rest\QueryParam( * name="hardDelete", * requirements="(true|false)", * nullable=true, * description="If set to 'true', only the super admin will have access to the resource." * ) * @Security("has_role('ROLE_COMPANY_ADMIN')") * @Rest\View * @Doc\ApiDoc( * section="Cabs", * resource=true, * description="Deletes a cab entity.", * statusCodes={ * Response::HTTP_OK = "Successful", * Response::HTTP_FORBIDDEN = "Access denied", * Response::HTTP_BAD_REQUEST = "Bad request" * } * ) */ public function deleteAction(Request $request, ParamFetcher $paramFetcher, Cab $cab) { $hardDelete = $paramFetcher->get('hardDelete'); if ($hardDelete == "false") $this->get('cab_manager')->deleteCab($cab); else $this->get('cab_manager')->deleteCab($cab, true); // TODO: normalize 'on succeed deletion' message return 'Success: Object deleted'; } /** * Finds a cab entity. * * @Rest\Get( * path="/cabs/{cabId}", * requirements={ "cabId" = "\d+"} * ) * @Rest\View( * SerializerGroups = {"CAB_DETAILS", "LIST"} * ) * Security: Not secured * @Doc\ApiDoc( * section="Cabs", * resource=true, * description="Finds a cab entity.", * statusCodes={ * Response::HTTP_OK = "Successful", * Response::HTTP_FORBIDDEN = "Access denied", * Response::HTTP_BAD_REQUEST = "Bad request" * } * ) */ public function showAction($cabId) { return $this->get('cab_manager')->getOneCab($cabId); } /** * Lists cab entities. * * @Rest\Get("/cabs") * @Rest\QueryParam( * name="companyId", * requirements="\d+", * nullable=true, * description="If specified, fecth only the Cabs belonging to the copany with that 'companyId'." * ) * @Rest\QueryParam( * name="minCostPerHour", * requirements="\d+", * nullable=true, * description="the minimum cost per hour for a booking." * ) * @Rest\QueryParam( * name="maxCostPerHour", * requirements="\d+", * nullable=true, * description="the maximum cost per hour for a booking." * ) * @Rest\QueryParam( * name="minCostPerDay", * requirements="\d+", * nullable=true, * description="the minimum cost per day for a booking." * ) * @Rest\QueryParam( * name="maxCostPerDay", * requirements="\d+", * nullable=true, * description="the maximum cost per day for a booking." * ) * @Rest\QueryParam( * name="activeOnly", * requirements="(true|false)", * nullable=true, * default = "true", * description="set to true to get only active cabs" * ) * @Rest\QueryParam( * name="includeDeleted", * requirements="(true|false)", * nullable=true, * default = "false", * description="set to true to include hard deleted cabs.(Make sense only with ativeOnly = false" * ) * @Rest\View( * SerializerGroups = {"LIST"} * ) * Security: Not secured * @Doc\ApiDoc( * section="Cabs", * resource=true, * description="Fetch a list of cabs.", * statusCodes={ * Response::HTTP_OK = "Successful", * Response::HTTP_FORBIDDEN = "Access denied", * Response::HTTP_BAD_REQUEST = "Bad request" * } * ) */ public function listAction(ParamFetcher $paramFetcher) { $companyId = $paramFetcher->get('companyId'); $minCostPerHour = $paramFetcher->get('minCostPerHour'); $maxCostPerHour = $paramFetcher->get('maxCostPerHour'); $minCostPerDay = $paramFetcher->get('minCostPerDay'); $maxCostPerDay = $paramFetcher->get('maxCostPerDay'); $activeOnly = $paramFetcher->get('activeOnly'); $includeDeleted = $paramFetcher->get('includeDeleted'); $cabs_array = $this ->get('cab_manager') ->getCabs($companyId, $minCostPerHour, $maxCostPerHour, $minCostPerDay, $maxCostPerDay, $activeOnly, $includeDeleted); return $cabs_array; } }
Coded With 💗 by
0x6ick