Community

getResources isn't processing the member rights

Hi,
I have created a website with articles (collections) and different member groups. Each group got acces to different articles. This all works fine, but now I want to showcase it with getResources.

The output is only the few articles that are accessible for everyone. When I clear the cache, the full list of all articles that are created appears. Nothing changes when a member is logged in. There must be some miscommunication between the member rights and getResources. I have tried everything several times and have no idea what’s the problem. Also I don’t know why everything appears when I clear the cache.

This is the call:
[[getResources?
&showHidden=1
&parents=7
&depth=1
&sortby={"publishedon":"DESC"}
&tpl=weergaveOverzicht
&includeTVs=1
&processTVs=1
&tvPrefix=``
&limit=0
]]

Can someone help me?
Thank you in advance!

getResources applies permissions, so when you as manager user clear the cache and visit the page, it will use your manager permissions to render all pages.

That’s then written to cache.

When the cache is cleared and the first user to visit that listing does not have permission to view them all, it only lists what they can access.

And then that is written to cache.

If the output of a snippet may be different from request-to-request, whether due to permissions, a request variable, or something time-based, you will need to call that snippet uncached.

Replace [[getResources with [[!getResources.

1 Like

Thanks Mark!
I think that I understand what you’re saying. But I want the list to match with the articles the user has access to. It now doesn’t make a difference if someone is logged in or not. At the moment, people that should have access to all articles only see the ones that everyone got access to. Something goes wrong here. Do you understand the problem?

1 Like

did you try to call your snippet uncached, like Mark suggested?

[[!getResources
1 Like

Oh wow. I first read it different, but its very clear now, and it works! Thanks a lot!

2 Likes

You want to build up permissions fresh each time, so the uncached call will start from scratch

Good to know! Thank you!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.