We have built a rather large intranet site using MODx 2.2.8. On this site are certain pages that can only be viewed by certain groups. Obviously, we don't want these pages showing up in the navigation for users who will get an unauthorized error if they click. Wayfinder generates the navigation correctly for the logged-in user, but only when called uncached. And as it turns out, Wayfinder is among the most expensive snippets in system resources. Preliminary testing indicates that an uncached Wayfinder call adds at least two seconds to every page load on our site. As we continue to add more resources, this problem will only get worse. But if we cache Wayfinder to preserve resources, the same menu shows up no matter which group is logged in.
So far I have come up with one possible solution, which in my opinion is a kludge. It is to call a different instance of Wayfinder for each user group using a conditional. If I'm thinking correctly, these Wayfinder calls could then be cached safely, as each one would be cached on its own. The implementation would look something like this:
<nav>
[[+modx.user.id:ismemberof=`group1`:then=`
[[Wayfinder? startId=`0`]]
`]]
[[+modx.user.id:ismemberof=`group2`:then=`
[[Wayfinder? startId=`0`]]
`]]
</nav>
Like I said, it's a kludge - and I'm not a hundred per cent sure it would work.
Even though Google has not yielded a solution to this problem with caching and permissions, I cannot imagine that I am anywhere near the first developer to deal with it. So, who out there has found a good solution, or even has some idea of what might work better? I can't wait to hear from you.