We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43899
    • 26 Posts
    I am using "login" to handle access to private pages.
    Inside these pages I provide links to .pdf files on the same web server.
    Now I noticed that the world can access these private documents when they type the URL directly.
    http://<baseURL>/assets/intern/<DocumentName.pdf> can be opened outside the logged-in user.

    How can I link access rights of external documents to a ModX user group?

    Regards
    Christoph
      • 4172
      • 5,888 Posts
      you can put a .htaccess - file to the pdf-directory with
      deny from all


      and create a private 'static resource' for each pdf-file
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • Or you can store the files outside of the web root, and have the static resources point to the files.

        You also need to create a custom Content Type for the .pdf files, set to "binary", as well as having the static resource's Content Dispositon setting be "Attachment". MODx will stream a binary static resource's target file.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 43899
          • 26 Posts
          Thanks a lot!
          I choose Bruno's solution - This makes recreation of 100+ static resources a little easier (can copy original URL).
          Thanks to Susan for the extra bit of detail - this saved me additional research in the documentation.