2

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:

  1. This T val = mvcContext.GetDataSourceItem<T>() might have empty links inside the returned model even when accessed by authorized user
  2. This 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?

2
  • 1
    I think that it won't know to vary by user role. So I doubt this is supported - I'd say create an issue on the Glass github. Oct 4, 2021 at 4:31
  • Created an issue here. This seems something to be careful of when upgrading as Glass might return data the user does not have access to.
    – Jeroen
    Oct 4, 2021 at 20:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.