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

Search Restrictions on item type's non primitive members

Former Member
0 Likes
335

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());
     } 

View Entire Topic
Former Member
0 Likes

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