Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi Alex,
Rather than try to evaluate it yourself, I suspect just using contentarea.FilteredItems would do what you need. FilteredItems applies the personalisation rules as well as checking permissions and published status of the content in the contentarea so will return only items which the current user should be able to see.
Hello Paul,
Ideed, FilteredItems did the trick in my case. Thank you so much!
Hey Alex!
Don't forget to mark the correct answer. Helps out future visitors.
Hello guys,
I have some geolocation based Visitor Groups and a content area withe several blocks. How can i know if each of the blocks meets the requirement of the Visitor Group set in episerver?
So far I looped through AllowedRoles, i get the visitor group, i get the user from context. Now, how can i check that the user is able or not to see the block?
foreach (var content in contentarea.Items) { if (content.AllowedRoles != null) { var match = false; foreach (var item in content.AllowedRoles) { var visitorGroupRepo = ServiceLocator.Current.GetInstance(); var vg = new Guid(item); var visitorGroup = visitorGroupRepo.Load(vg); var user = HttpContext.User; // how what? } } }