As part of a Sitecore upgrade I'm also upgrading
Glass Mapper to latest version (
5.8.177). We were previously on version 4. Our site uses Sitecore OOTB Security and some users do not have read access to certain items. In our Glass models we use
Glass.Mapper.Sc.Fields.Link fields. Such a field could have a link to an item where not all users have access to. In this case the link will not have an URL which makes sense as the user does not have read permission to this item.
Now with Glass V5 there is a lot more caching. Now some link fields still return empty values even when they are accessed by someone who has permission to view the link. For example:
T val = mvcContext.GetDataSourceItem<T>()might have empty links inside the returned model even when accessed by authorized user
T val = mvcContext.GetDataSourceItem<T>(x => x.CacheDisabled())seems to always have the correct links (based on the user's permissions)
I was reading up on the new caching here:
It is also worth remembering that cached models are reused regardless of the page being requested. So once you have built the models for your navigation they will be reused over and over again.
I feel like I'm probably missing something here, how do I make sure the caching respects the permissions?