Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
mathieu
technobel.sf
Commits
cbf16252
Commit
cbf16252
authored
Jul 12, 2018
by
Mat
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test_seecurity_bearer'
parents
2929163c
0815c85e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
0ne/orig/ajax/index4.html
0ne/orig/ajax/index4.html
+1
-1
src/Api2Bundle/Controller/BrasserieController.php
src/Api2Bundle/Controller/BrasserieController.php
+3
-3
No files found.
0ne/orig/ajax/index4.html
View file @
cbf16252
...
...
@@ -54,7 +54,7 @@ $(document).ready(function()
if
(
!
options
.
beforeSend
)
{
options
.
beforeSend
=
function
(
xhr
)
{
// avec 2 espaces entre bearer et le token !!!!
xhr
.
setRequestHeader
(
'
Authorization
'
,
'
bearer
'
+
sessionStorage
.
getItem
(
'
token
'
));
xhr
.
setRequestHeader
(
'
Authorization
'
,
'
bearer
'
+
sessionStorage
.
getItem
(
'
token
'
));
}
}
});
...
...
src/Api2Bundle/Controller/BrasserieController.php
View file @
cbf16252
...
...
@@ -13,8 +13,8 @@ use Symfony\Component\HttpFoundation\Request;
/**
* Class BrasserieController
*
* //@Security("has_role('ROLE_USER')")
* @package Api2Bundle\Controller
* @Security("has_role('ROLE_USER')")
*/
class
BrasserieController
extends
FOSRestController
{
...
...
@@ -23,8 +23,9 @@ class BrasserieController extends FOSRestController
* @Rest\Get(path="/brasserie")
* @Rest\View(serializerGroups={"getBrasserie"})
*/
public
function
getAction
()
public
function
getAction
(
Request
$request
)
{
//dump($request); die;
return
$this
->
getDoctrine
()
->
getRepository
(
Brasserie
::
class
)
->
findAll
();
...
...
@@ -41,7 +42,6 @@ class BrasserieController extends FOSRestController
public
function
putAction
(
Request
$request
,
Brasserie
$id
)
{
// le fait de typer $id fait qu'il retourne un objet !
//dump($request); die;
$form
=
$this
->
createForm
(
BrasserieType
::
class
,
$id
,
array
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment