Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Liferay 7.3.7 error “Denied access to model object as it does not belon
I'm preparing to migrate from Liferay 7.3.5GA6 to 7.3.7GA8 version. I'm facing an error on a ftl template that states: Denied access to model object as it does not belong to current company 20116 The code in which this happens is the following:
<#list AssetEntryAssetCategoryRelLocalService.getAssetEntryAssetCategoryRelsByAssetCategoryId(category.getCategoryId()) as curEntry>
This is working properly on 7.3.5GA6. I've found 2 similar bugs on Liferay Bug tracking, https://issues.liferay.com/browse/LPS-133074 and https://issues.liferay.com/browse/LPS-125553 but they're not exactly the same. I presume it's something related to new security capabilities from one of the bugs, but I'm not sure if in my case it's a bug or really it's working as expected
I've found the problem. It appears to be related to an earlier
migration, from 7.1.3 to 7.3.5. In that migration, the model for
relation between categories and assets changed, and the migration
process left some "garbage" behind. In my case, some of the
entries in the ASSETENTRYASSETCATEGORYREL table had the COMPANYID
column with NULL value. They were not being used, but in my code, as I
was taking all the relations for a particular categoryId, they had the
NULL value instead of 20116 (my companyId value), and thus the
error.
I've deleted all the entries with NULL value and
everything works again.
Powered by Liferay™