Hi Dynamicweb,
We are testing with the latest version of DW (9.6.13) and see some issues with the assortments... Try the following:
- Access a product which is locked by an assortment with a direct link => the product is not displayed => CORRECT
- Access the same product with a user having access to the product => the product is displayed => CORRECT
- Now access the same product not logged in and without having access to the product => the product can now be displayed => NOT CORRECT
I think the issue is in this method:
Public Function GetProductById(productId As String, productVariantId As String, productLanguageId As String, useAssortments As Boolean) As Product
'Get from cache
Dim cacheResult As ProductCacheResult = Nothing
If Not String.IsNullOrWhiteSpace(productLanguageId) Then
cacheResult = GetProductFromCache(productId, productLanguageId, productVariantId)
End If
If cacheResult Is Nothing Then
cacheResult = GetProductFromCache(productId, Common.Context.LanguageID, productVariantId)
End If
If cacheResult.ProductMissingInCache.Any() Then
Dim product As Product = Repository.GetProductById(productId, productVariantId, productLanguageId, useAssortments)
If product Is Nothing AndAlso String.IsNullOrWhiteSpace(productLanguageId) AndAlso Functions.ShowUnTranslatedItems() AndAlso
Not productLanguageId.Equals(Application.DefaultLanguage.LanguageId, StringComparison.OrdinalIgnoreCase) Then
product = GetProductById(productId, productVariantId, Application.DefaultLanguage.LanguageId, useAssortments)
End If
AddProductToCache(product)
Return product
Else
Return cacheResult.CachedProducts(0)
End If
End Function
Where the product is just returned if cached without checking access to the proper assortment.
Will you please try to look into this?
Best regards, Anders