aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-02-10 08:35:43 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-02-10 08:35:43 +0100
commitc5e8ba25bb0d6d59b3275480f406b5ce3fa83b75 (patch)
tree9dc8ec3e6e68547287e1a69a1939530fb78927f8 /src
parent7ffb1e80bff2c54fe3fe4343484d377eda660c3f (diff)
downloadwallabag-c5e8ba25bb0d6d59b3275480f406b5ce3fa83b75.tar.gz
wallabag-c5e8ba25bb0d6d59b3275480f406b5ce3fa83b75.tar.zst
wallabag-c5e8ba25bb0d6d59b3275480f406b5ce3fa83b75.zip
getSalt method
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Controller/WallabagRestController.php27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
index 75e5204e..96d2529a 100644
--- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
@@ -8,11 +8,35 @@ use Symfony\Component\HttpFoundation\Request;
8use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; 8use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\CoreBundle\Entity\Tags; 10use Wallabag\CoreBundle\Entity\Tags;
11use Wallabag\CoreBundle\Entity\User;
11use Wallabag\CoreBundle\Service\Extractor; 12use Wallabag\CoreBundle\Service\Extractor;
12 13
13class WallabagRestController extends Controller 14class WallabagRestController extends Controller
14{ 15{
15 /** 16 /**
17 * Retrieve salt for a giver user.
18 *
19 * @ApiDoc(
20 * parameters={
21 * {"name"="username", "dataType"="string", "required"=true, "description"="username"}
22 * }
23 * )
24 * @return string
25 */
26 public function getSaltAction($username)
27 {
28 $user = $this
29 ->getDoctrine()
30 ->getRepository('WallabagCoreBundle:User')
31 ->findOneByUsername($username);
32
33 if (is_null($user)) {
34 throw $this->createNotFoundException();
35 }
36
37 return $user->getSalt();
38 }
39 /**
16 * Retrieve all entries. It could be filtered by many options. 40 * Retrieve all entries. It could be filtered by many options.
17 * 41 *
18 * @ApiDoc( 42 * @ApiDoc(
@@ -85,8 +109,7 @@ class WallabagRestController extends Controller
85 $url = $request->request->get('url'); 109 $url = $request->request->get('url');
86 110
87 $content = Extractor::extract($url); 111 $content = Extractor::extract($url);
88 $entry = new Entry(); 112 $entry = new Entry($this->getUser()->getId());
89 $entry->setUserId($this->getUser()->getId());
90 $entry->setUrl($url); 113 $entry->setUrl($url);
91 $entry->setTitle($request->request->get('title') ?: $content->getTitle()); 114 $entry->setTitle($request->request->get('title') ?: $content->getTitle());
92 $entry->setContent($content->getBody()); 115 $entry->setContent($content->getBody());