Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-122276

InlineSQLHelperImpl inserts ResourcePermissionSQL to first WHERE clause

    Details

      Description

      Reproduction steps:

      1. Create a new user "user1"
      2. Replace the groupId in the attached Groovy script test.groovy
        import java.util.ArrayList;
        import com.liferay.journal.service.JournalArticleServiceUtil;
        import com.liferay.portal.kernel.model.User;
        import com.liferay.portal.kernel.security.auth.CompanyThreadLocal;
        import com.liferay.portal.kernel.security.permission.PermissionChecker;
        import com.liferay.portal.kernel.security.permission.PermissionCheckerFactoryUtil;
        import com.liferay.portal.kernel.security.permission.PermissionThreadLocal;
        import com.liferay.portal.kernel.service.UserLocalServiceUtil;
        
        long groupId = <<INSERT GROUP ID HERE>>;
        long companyId = CompanyThreadLocal.getCompanyId();
        User user1 = UserLocalServiceUtil.getUserByScreenName(companyId, "user1");
        
        PermissionChecker checker = PermissionCheckerFactoryUtil.create(user1);
        PermissionThreadLocal.setPermissionChecker(checker);
        
        try {
        	JournalArticleServiceUtil.search(
        		companyId, groupId, new ArrayList<Long>(), 0,
        		null, null, null, null,
        		"asdfgh", "BASIC-WEB-CONTENT", "BASIC-WEB-CONTENT",
        		null, null, 0, null,
        		true, -1, -1,
        		null);
        }
        catch(Exception ex) {
        	out.println("ERROR:");
        	ex.printStackTrace(out);
        }
        
      3. Run the script at Control Panel→Configuration→Server Administration→Script→copy-paste→Execute

      Expected behaviour: No error is shown in the output
      Actual behaviour: SQL error is shown in the output

        Attachments

          Activity

            People

            Assignee:
            della.wang Della Wang (Inactive)
            Reporter:
            balazs.safrany-kovalik Balázs Sáfrány-Kovalik
            Participants of an Issue:
            Recent user:
            Yunlin "Steven" Sun
            Engineering Assignee:
            Balázs Sáfrány-Kovalik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              38 weeks, 4 days ago

                Packages

                Version Package
                7.2.X
                7.3.10 DXP FP1
                7.3.10.1 DXP SP1
                7.3.6 CE GA7
                7.3.X
                Master