上传私人文件?
我希望能够使用 django-cms 上传文件,并且这些文件仅对经过身份验证的用户可见。
我已经创建了一个“仅限会员”页面,单击“需要登录”并为菜单可见性选择“仅限登录用户”(“/admin/cms/page 下的高级设置”)。这让我得到了一些我想要的;除非您登录,否则页面本身不可见。并且菜单项也会消失。
但是,下一步我可以使用“文件”插件上传文件。在下面即使您看不到显示链接的页面,如果您有该文件的直接 URL,您仍然可以访问该文件,它不仅可以保护该页面,还可以保护该文件。 。
我知道大部分(好吧,一些)django 的方法,所以我可以做一些黑客工作来获得解决方案(并不是说它会从头开始编写整个文件管理器) 不做一个漂亮的小开源软件项目)。
I want to be able to upload files using django-cms, and have those files only be visible to authenticated users.
I've gotten as far as creating a "Members only" page, clicking "Login required" and selecting "for logged in users only" for Menu visibility ("advanced settings under /admin/cms/page). This gets me some of what I want; the page itself is not visible unless you're logged in. And the menu item goes away too.
But, the next step is a problem. I can upload a file using the "file" plugin. This puts the file under /media/cms_page_media/. Even though you can't see the page which displays the link, you can still get to the file if you have the direct URL to it. What I need is something which not only protects the page, but the files uploaded to it.
I know my way around most (well, some) of django, so I could do a bit of hacking to get a solution. I'm hoping to avoid writing an entire file manager from scratch (not that it wouldn't make a nice little OSS project).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Django Filer (https://github.com/stefanfoulis/django-filer) 在最新版本中具有此选项。它还有一组很好的 CMS 插件,比默认的文件插件增加了很多价值: https:// github.com/stefanfoulis/cmsplugin-filer
Django Filer (https://github.com/stefanfoulis/django-filer) has this option in the newest release. It also has a nice set of CMS Plugins which add a lot of value over the default File plugin: https://github.com/stefanfoulis/cmsplugin-filer