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

Search Restriction is applied but does not filtering the results

former_member643591
Discoverer
0 Kudos
416

When I execute the below query in HAC(admin user), I am getting the expected results but the same query is used in search restriction in backoffice for vendor user role, it is showing all the products.

Select count(distinct {p.pk}) from {Vendor as v JOIN VendorUnavailableProducts as vup ON {vup.vendor} = {v.pk} JOIN Vendor2UnavailProducts as v2up ON {v2up.source} = {vup.pk} JOIN product as p ON {v2up.target} = {p.pk} JOIN CatalogVersion as cv ON {cv.pk} = {p.catalogversion} JOIN Catalog as c ON {c.pk} = {cv.catalog} } where {v.code} ='1679' and {c.id} = 'myProductCatalog'

Did I miss something in the below search restriction? INSERT_UPDATE SearchRestriction;code[unique=true];name[lang=en];restrictedType(code);principal(uid);active;generate;query ;tr_icecreamvendoradmin_product_restricted;;Product;icecreamvendoradmingroup;true;true;{pk} in ({{Select distinct {p.pk} from {Vendor as v JOIN VendorUnavailableProducts as vup ON {vup.vendor} = {v.pk} JOIN Vendor2UnavailProducts as v2up ON {v2up.source} = {vup.pk} JOIN product as p ON {v2up.target} = {p.pk} JOIN CatalogVersion as cv ON {cv.pk} = {p.catalogversion} JOIN Catalog as c ON {c.pk} = {cv.catalog} } where {v.code} ='1679' and {c.id} = 'myProductCatalog'}})

Accepted Solutions (0)

Answers (1)

Answers (1)

arvind-kumar_avinash
Active Contributor
0 Kudos

On the application of the restriction, the effective FlexibleSearch statement will be as follows:

 SELECT {pk} FROM {Product} WHERE {pk} IN ({{SELECT DISTINCT {p.pk} FROM {Vendor AS v JOIN VendorUnavailableProducts AS vup ON {vup.vendor} = {v.pk} JOIN Vendor2UnavailProducts AS v2up ON {v2up.source} = {vup.pk} JOIN Product AS p ON {v2up.target} = {p.pk} JOIN CatalogVersion AS cv ON {cv.pk} = {p.catalogversion} JOIN Catalog AS c ON {c.pk} = {cv.catalog} } WHERE {v.code} ='1679' AND {c.id} = 'myProductCatalog'}})

Please check your query if it is what you want icecreamvendoradmingroup to restrict to.