We'd like to have import and export capability for widget.
When exporting a widget, the following information must be exported with it, so that it can be exported back:
- Widget identifier
- Permissions: a list of roles and the actions allowed for users with that role. We need to consider 4 types of roles:
- Team: The name/key of the team should be exported.
- On import, a team with the same name/key must exist in the site where the page is imported.
- Widget Configuration: Each widget can have its own code to store and retrieve configuration. However most of them leverage the standard portlet preferences mechanism. Even in this case, though it's also worth noting that the names and values of the specific preferences for a widget might not want to be exposed when exporting. Considering this, it's necessary to provide:
- An extension point which allows widget developers to provide their own PortletConfigurationExporterImporter which can retrieve the configuration from its storage and transform it as desired before the export or import.
- A default implementation which obtains the configuration from portlet preferences and does not transformation. This implementation will be used for any widget without an specific PortletConfigurationExporterImporter
- We will provide implementations of PortletConfigurationExporterImporter for any out of the box widgets which require a transformation, for example to avoid exporting primary keys (which would be the case for Web Content Display, Asset Publisher, etc).
- Note: create sub-task to identify out of the box portlets that need transformation
Note: When importing widget permissions, if a specific role is not found, then the permissions for it will be ignored. Ideally a message will be shown to the user such as: "Widget X had permissions assigned for role Y which has not been found, so those permissions have not been imported". This is a deviation from the general policy when importing pages consisting in always importing and not checking for existence. The reason why we have to make this exception is that there is no way to save the permissions for a role in Liferay if the role does not exist.
- Related to PortletConfigurationExporterImporter:
- We need to think through if we want to have a single PortletConfigurationExporterImporter interface or it's better to split it in two.
- PortletConfigurationExporterImporter should use JSON as the outside facing format, which is produced by the exporter and received by the importer.
|Test Scenarios||Test Strategy||Kind of test||Is it covered by FrontEnd ? (JS-Unit)||Is it covered by BackEnd ? (unit or integration)||Could it be covered by POSHI?|
|The widgetInstanceId will be exported and imported with content page template||Smoke||Manual||No||Yes||Yes|
|The configuration of widgets will be exported and imported with master page template||Smoke||Manual||No||Yes||Yes|
|The Regular and Site Role permission settings of widgets will be exported and imported with content page template||Smoke||Manual||No||Yes||Yes|
|The Organization permission settings of widgets will be exported and imported with master page template||Sanity||Manual||No||No||Yes|
|The Team Role permission settings of widgets will be exported and imported with content page template||Sanity||Manual||No||No||Yes|
|The specific message will be shown when import content page template where the widget has permission settings for a Role if it doesn't exist in site||Sanity||Manual||No||No||Yes|