I'm creating a website where I want users to be able to login. I'm using https://craftcms.com/docs/templating/login-form to achieve this. No problem so far.
When a user is logged in, I want the user to be able to reach the asset folder (depending on what the rights are for his user-group). When not logged in, I want the asset url to be private. For this to work I've placed the asset folder outside the webroot, so you can't access the asset folder by default.
I've tried to achieve this with this plugin: https://github.com/tikiatua/internal-assets-plugin But without any success.
My general config:
'enableTemplateCaching' => false,
'devMode' => true,
'siteUrl' => 'http://website.loc/',
'loginPath' => 'http://website.loc/',
'environmentVariables' => array(
'internalAssetsPath' => CRAFT_BASE_PATH . "../media/",
'internalAssetsUrl' => "http://website.loc/media/"
)
I can upload a image in my internalAssetsPath, but when I try to show this in front-end, I get a 404.
{% for image in craft.assets.kind('image') %}
<li><img src="{{ image.getUrl() }}" alt="{{ image.title }}"></li>
{% endfor %}
A solution for the 404 problem would be nice, but a solution for reaching the asset folder when logged in would be great.