mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-12 16:58:37 +00:00
parent
8e58be9fb6
commit
23406ca3f1
4 changed files with 95 additions and 3 deletions
|
@ -19,7 +19,7 @@ class DeveloperController extends Controller
|
|||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll();
|
||||
$clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findByUser($this->getUser()->getId());
|
||||
|
||||
return $this->render('@WallabagCore/themes/common/Developer/index.html.twig', [
|
||||
'clients' => $clients,
|
||||
|
@ -38,7 +38,7 @@ class DeveloperController extends Controller
|
|||
public function createClientAction(Request $request)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$client = new Client();
|
||||
$client = new Client($this->getUser());
|
||||
$clientForm = $this->createForm(ClientType::class, $client);
|
||||
$clientForm->handleRequest($request);
|
||||
|
||||
|
@ -75,6 +75,10 @@ class DeveloperController extends Controller
|
|||
*/
|
||||
public function deleteClientAction(Client $client)
|
||||
{
|
||||
if (null === $this->getUser() || $client->getUser()->getId() != $this->getUser()->getId()) {
|
||||
throw $this->createAccessDeniedException('You can not access this client.');
|
||||
}
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->remove($client);
|
||||
$em->flush();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue