I have XML files in a publicly accessible directory. I want to restrict them to accessible only to logged in users. So when I go to http://example.com/web/file.xml
only AUTHENTICATED members can access the file. I'm using PHP & Symfony2.
Asked
Active
Viewed 1,448 times
0

Darryl Hein
- 142,451
- 95
- 218
- 261

Najd developper
- 1
- 9
2 Answers
1
Files in web are all public so don't put it into that folder.
You can create a folder into Ressources and put your xml into it.
Then create an action witch read and display your file. In this way you will be able to secure your action.
For exemple you can access as http://monsite.com/xml/get
How to secure : http://symfony.com/doc/current/cookbook/security/securing_services.html

Bang
- 919
- 4
- 11
0
I solve the problem with this
$filename = $this->get('kernel')->locateResource("@SomeBundle/Resources/folder/file.xml");

Community
- 1
- 1

Najd developper
- 1
- 9