I am creating a program that is capable of storing PDFs for the user. These PDFs are stored in web/uploadedFiles/uploads/documents.
Lets say user A uploads a document X.pdf. User A do not want User B to be able to access this document. As it is now, User B can type: www.[url].com/web/uploadedFiles/uploads/documenets/x.pdf and view the file. How can I make sure file X.pdf is only viewable for User A (And those user A says can view the file for that matter).
firewalls:
secured_area:
pattern: ^/
anonymous: ~
http_basic:
realm: "Secured Demo Area"
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
- { path: ^/uploadedFiles/, role: ROLE_ADMIN }
To make it easier I first tried to make the "folder" only accessible for admins.
tl;Dr: Make complete folder in /web/ only accessible for admins.