cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Search Restrictions on item type's non primitive members

Former Member
0 Kudos
303

Hi experts,

I have been trying to disable search restrictions before calling super categories method of product model but apparently restriction does not seem to be disabling as intended result is not being returned.

 final ProductModel product  = productService.getProductForCode("100100");
 final Collection<CategoryModel>  categories = fetchCategories(() -> product.getSupercategories());
 
 // I always get categories empty if I have put restrictions on product's super categories.
 
 private <T> T fetchCategories(final Supplier<T> supplier) {
         return sessionService.executeInLocalView(new SessionExecutionBody() {
             @Override
             public T execute() {
                 try{
                     searchRestrictionService.disableSearchRestrictions();
                     sessionService.setAttribute("disableRestrictionGroupInheritance", Boolean.TRUE);
                     return supplier.get();
                 }finally{
                     searchRestrictionService.enableSearchRestrictions();
                 }
             }
         }, userService.getAdminUser());
     } 

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member630291
Participant
0 Kudos

I'm also struggling with an issue related to this. Did you get to resolve this?

Former Member
0 Kudos

Hi... I am facing one similar issue. Were you able to get any help in this issue ?