X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FController%2FDeveloperController.php;h=c8a1c6355b9f11a1b7a15dc4acd13eb282811b73;hb=f808b01692a835673f328d7221ba8c212caa9b61;hp=550c06087cd6329f7901709f6f21bef6adef8395;hpb=eb2d613c3ed95d741e987917f976da349ea240eb;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ApiBundle/Controller/DeveloperController.php b/src/Wallabag/ApiBundle/Controller/DeveloperController.php index 550c0608..c8a1c635 100644 --- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php +++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php @@ -3,8 +3,8 @@ namespace Wallabag\ApiBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; -use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\HttpFoundation\Request; use Wallabag\ApiBundle\Entity\Client; use Wallabag\ApiBundle\Form\Type\ClientType; @@ -42,8 +42,8 @@ class DeveloperController extends Controller $clientForm = $this->createForm(ClientType::class, $client); $clientForm->handleRequest($request); - if ($clientForm->isValid()) { - $client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']); + if ($clientForm->isSubmitted() && $clientForm->isValid()) { + $client->setAllowedGrantTypes(['client_credentials', 'token', 'authorization_code', 'password', 'refresh_token']); $em->persist($client); $em->flush(); @@ -75,7 +75,7 @@ class DeveloperController extends Controller */ public function deleteClientAction(Client $client) { - if (null === $this->getUser() || $client->getUser()->getId() != $this->getUser()->getId()) { + if (null === $this->getUser() || $client->getUser()->getId() !== $this->getUser()->getId()) { throw $this->createAccessDeniedException('You can not access this client.'); }