上传私人文件?

发布于 2024-12-12 20:49:42 字数 355 浏览 2 评论 0原文

我希望能够使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凑诗 2024-12-19 20:49:42

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文