Each Liferay table has the following Liferay classes:
- *ServiceUtil
- *LocalService
e.g. for User:
- UserServiceUtil
- UserLocalServiceUtil
*LocalServiceUtil has no permission check, *ServiceUtil has permission check.
Main tables:
The following is a simple approach and not complete (see liferay documentation)!
Authorization:
- company: companyid is needed in almost every function
- organization_: organizationid refers to the startingpoint of myplaces
- role_: role is used for fine granular permissions
- user: user is member of a organization and has several roles
Portal:
- layout: Layouts are the pages under a organization and can have roles. Organizations and layouts can be hierarchical.
- resource_
Portal import:
With the *ServiceUtil classes are custom import of a portal is possible. The source could be e.g. a XML description of the portal.
These are the main steps:
- Get the company with PortalUtil.getCompanyId
- Create organization(s) with OrganizationServiceUtil.addOrganization
- Create role(s) with RoleServiceUtil.addRole
- Create pages with LayoutServiceUtil.addLayout
- Set the page theme with LayoutSetServiceUtil.updateLookAndFeel
- Create portletpreferences with PortletPreferencesLocalServiceUtil.addPortletPreferences
- Add the portlets to the page with LayoutServiceUtil.updateLayout. This is very tricky. You have to add the portlet with typesettings to the corresponding position in the layout.
- App role(s) to the pages with PermissionServiceUtil.setRolePermissions. For this call you need the resouresid of the layout with ResourceLocalServiceUtil.getResource. To get the role simple call RoleServiceUtil.getRole.
To find out the parameters for the functions do the following:
- Add a breakpoint to com.liferay.portal.dao.orm.hibernate.SessionImpl
- Do the steps manually with the Liferay admin tools
- Search in the stack trace for the function and you see the parameters
Attention:
Because the *ServiceUtil functions do a permission check, you must be logged in as administrator. You can call the import e.g. out of a portlet.

Keine Kommentare:
Kommentar veröffentlichen