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

Simplify VerifyPermission for algorithms 1-5

    Details

      Description

      Currently, PermissionLocalService.checkPermissions() will call PermissionLocalService.checkPermission() once for every resource. During each call to PermissionLocalService.checkPermission(), a lot of data will be re-retrieved from a thread local cache (with a low probability), MultiVMPool (with a moderate probability) or the database (in the case that the permissions finder/entity caches is not optimized for the amount of data handled in the upgrade, which will be true in many cases).

      • In order to retrieve the resource name, the ResourceCode will be accessed twice for every resource
      • In order to retrieve the default permissions, the local map in ResourceActionsUtil will be accessed for every resource for both guest and site permission defaults
      • In order to retrieve role ids, a list of roles with that name will be accessed three times for every resource

      In the last case, PermissionLocalService.addRolePermissions() iterates over all roles with the same name. However, a permissionId is only applicable to one companyId, not all companyIds; it is not necessary to add the permission to the roleIds from other companies. Therefore, the logic is incorrect in addition to being wasteful from a cache access perspective.

      The logic can be simplified so that rather than accessing the data once for every resource, we instead retrieve it once for every ResourceCode.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michael.saechang Michael Saechang
              Reporter:
              minhchau.dang Minhchau Dang
              Participants of an Issue:
              Recent user:
              Marta Elicegui
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                8 years, 51 weeks, 2 days ago

                  Packages

                  Version Package
                  6.1.1 CE GA2
                  6.1.20 EE GA2