开发者

Django File Access Security

开发者 https://www.devze.com 2022-12-15 06:06 出处:网络
I want to restrict access to all but a few selected files per a user, but if I type: /media/userdocuments/FILENAME django happily spits back the file for even users who aren\'t logged in. How can I in

I want to restrict access to all but a few selected files per a user, but if I type: /media/userdocuments/FILENAME django happily spits back the file for even users who aren't logged in. How can I integrate the permission framework to work around this?

Thanks!

EDIT: I realize that the d开发者_StackOverflowjango development server is insecure, so I guess the question is: How would I do that in a production environment with apache, lighttp, etc.


Use RewriteMap along with a script that connects to Django and verifies permissions, rewriting to a "disallowed" URL on auth failure.

0

精彩评论

暂无评论...
验证码 换一张
取 消