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

Unable to clear defaults and unsupported permissions with OSGi

    Details

      Description

      In past releases of Liferay (such as 6.2.x and before), users were able to modify the default and unsupported permissions for site members and guests by creating an EXT plugin and overriding the specific XML file that provided the initial permissions.

      This meant that even though the files were usually additive, by overriding the file that's checked in the classpath, you could effectively remove supported or default permissions.

      With OSGi, the way the classpath works is that the bundle itself is always preferred over fragment bundles. This means that the additive nature of defining permissions via a resource actions XML makes it so that it is now impossible to remove default permissions programmatically without deploying a completely different bundle (which is not a maintainable solution).

      To allow for the original use of custom resource action XML files within EXT plugins, we could allow for the second file to take precedence when defining the "*-defaults" and "guest-unsupported", but retain the additive behavior for other elements within the XML file. This would allow us to remove defaults or unsupported permissions with the following steps.

      1. Create a new blade module.
      2. Specify "Fragment-Host: com.liferay.document.library.web" in the bnd.bnd for the new module
      3. Add a file src/main/resources/portlet-ext.properties with the following content
        resource.actions.configs=resource-actions/default.xml,resource-actions/default-ext.xml
        
      4. Create a new file src/main/resources/resource-actions/default-ext.xml with the following content
        <?xml version="1.0"?>
        <!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 7.0.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_7_0_0.dtd">
        
        <resource-action-mapping>
        	<model-resource>
        		<model-name>com.liferay.document.library.kernel.model.DLFileEntry</model-name>
        		<portlet-ref>
        		</portlet-ref>
        		<permissions>
        			<supports>
        			</supports>
        			<guest-defaults>
        			</guest-defaults>
        		</permissions>
        	</model-resource>
        </resource-action-mapping>
        
      5. Deploy the module

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 16 weeks ago

                Packages

                Version Package
                7.0.0 DXP FP14
                7.0.0 DXP SP3
                7.0.3 CE GA4
                7.0.X EE
                7.1.X
                Master