hhuijser/liferay-portal — pull request #1967 by yuhai (2014-06-24 09:22:30+00:00)
Title: LPS-44761  Site editors can't filter web content by structure

The pull request extends from https://github.com/juliocamarero/liferay-portal/pull/2851

For the current issue, except CompanyAdmin, all people can't see Site's journalArticles by using "browse by Structure". The reason is that exists groupId=0 as query situation when get data from journalarticle table. The groupId=0 was added by the below code:
####
JournalArticleFinderImpl.doCountByG_C_S() {
if (inlineSQLHelper) {
sql = InlineSQLHelperUtil.replacePermissionCheck(
sql, JournalArticle.class.getName(),
"JournalArticle.resourcePrimKey", groupId);
}
}
####

From my understanding, when groupId=0 and it means we can get all articles by using structureId. And it also means the structure was created in current site (belongs to the root structure). That is to say, when groupId=0, it should get all the articles from the current site and its subscopes by using this structure.

So the logic groupId=0 is right.

However, for the above mentioned code "if (inlineSQLHelper) {...}", it should only take effect when groupId>0 because our all article's groupId > 0. When groupId<=0, if we still execute inlineSQLHelper check, it is wrong.

By the way, I have tested Julio's mentioned test examples from the below link and the fix can fit with these test examples.
https://github.com/juliocamarero/liferay-portal/pull/2851#issuecomment-43957323

Thanks,
Hai