Hi there,
Is there a snippet that would allow me to check permissions when downloading a specific file?
My idea is that:
- files are stored in a folder (eg. assets/files/secure) and its subfolders
- .htaccess files does not allow to download them directly (eg by calling such link
http://mysite.com/assets/files/secure/presentations/framework.pps)
- a link to this file on a website (website accessible after login - webuser) would be something like this:
http://mysite.com/getfile.html?file=presentations/framework.pps
- getfile.html (containing call to the "XXX" snippet) would check if the currently logged in webuser belongs to a group which is permitted to download the file
- if the access rights are ok the snippet reads the binary content of the file and sends it to the user web browser as a proper mime-type (application/vnd.ms-powerpoint), with a proper name and size given in a header of the response.
- if user does not have sufficient permissions, a proper (chunk?) message is displayed.
Do You think that makes sense? Do You know if there is a snippet like this?
How do You take care of the files when You what to secure them?
PS: .htpasswd is not a good solution as it is separated from modx webusers
Thx
Greg