# Restricting access to images for nonmembers?

**URL:** <https://forum.getkirby.com/t/restricting-access-to-images-for-nonmembers/17995>\
**Category:** Questions\
**Tags:** v3\
**Created:** [April 24, 2020, 12:09am UTC](https://forum.getkirby.com/t/restricting-access-to-images-for-nonmembers/17995 "2020-04-24T00:09:08Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [April 24, 2020, 5:35am UTC](https://forum.getkirby.com/t/restricting-access-to-images-for-nonmembers/17995/3 "2020-04-24T05:35:55Z")

</div>

Hi FJN, welcome to the Kirby Forum!

You can use `if ($user = $kirby->user())` to test if there is a user currently logged in to Kirby in a template. So you can wrap this around a section to only show this section to logged in users.

However, there’s some caveats:

1. Don’t use caching on these pages!
2. Files remain directly accessible via path

As for 2: you can work around that too, but it’s a bit of work and not always wanted as it affects performance: files are served directly from your webserver without Kirby intercepting (for performance reasons). However, you can shove Kirby in between to manage all requests. There’s [a thorough post on how to create an “asset firewall” for Kirby 2](https://forum.getkirby.com/t/how-to-build-an-asset-firewall/1009/13). Whilst the philosphy remains the same, I think you’ll have to adapt the code to get it working with Kirby 3 a bit.

---

_[View the full topic](https://forum.getkirby.com/t/restricting-access-to-images-for-nonmembers/17995)._
