We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34178
    • 212 Posts
    Does anybody know how to protect the download of pdfs by a password in MODx?

    Would be great if anybody knows this ...
    Letti
      • 32316
      • 387 Posts
      I'm interested in this problem so I investigated:

      Use static resources -
      I set up a content type called pdf with mime type application/pdf

      I uploaded a pdf file (I put it in assets/pdf/ - but you can do whatever works for you!)

      I changed the permissions on the pdf file to 0640 - this means that if someone figures out the name of the file and its path they still will not be able to download it.

      I created a static resource that pointed to the pdf, used the content type of pdf

      I created a link (actually I just put it in a menu), clicking on the link downloaded the pdf, entering the url for the pdf results in a forbidden 403 page.

      Now we just have to limit access to the link/static resource with the infamous (but I believe improved) flexible Modx security system!

      to be continued, possibly!
        • 32316
        • 387 Posts
        Create a resource group
        put the static resource (that points to the pdf download) in the resource group
        add members to the resource group
        (these three actions are all accessed in the security menu)

        only 'members' will see the resource or links to it [ed. note: whistlemaker last edited this post 11 years, 11 months ago.]