I would like to get a file of custom user field, which is "asset", and provide a link to the file for the user.

However, the asset file cannot be gotten. The length of the asset field is zero. In addition, this issue happens only the currentUser is not admin. With admin account, the asset is gotten without any trouble.

Of course, the user has a permission to view the asset volume.

The asset volume has public URLs. On the other hand, the asset folder is out of web folder, but I do not realy think it is the cause because the asset file can be gotten with admin account.

And, my Craft is ver 3.1.33.

  • Edit: Try clearing the entire craft3 cms cache prior to the below advised testing to be sure that it's no simple caching issue of some sort. [Original]: Are there any differences between the assets link if accessed by admin compared to non-admin? And can you also try out opening said links while not logged in at all? This might be helpful towards figuring out wherein the issue lies. Thanks. – Campiotti Dec 4 '19 at 7:33
  • Thank you for your comment. 1) I cleared Craft cache, but the result is same. 2) With admin account, the link to the document is provided correctly. But with non-admin account, the link is not displayed because the asset field is empty. 3) Even with the non-admin account, it is possible to open the file with putting its URL directly. However, without login, the file is protected and the access is denied. – Kota.M Dec 4 '19 at 14:33
  • 1
    Can you turn on devmode and clear all your logs under storage/runtime/logs/* and then try and access/get the image to appear for a non-admin user and after that upload the logs in a zip to some file-host? It'll be easier to see if there's some error going on. (If you don't want to upload logs, simply replying with a list of the log files generated would already help out quite a bit) – Campiotti Dec 4 '19 at 15:36
  • Can you share the code you have currently? – dmatthams Dec 5 '19 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.