Wednesday, December 11, 2013

How to add Role with Liferay Portal Client

To create Role in Liferay programmatically, one of the possible way is through Liferay Portal Client and its' web service.

Pre-requisite: Setup Liferay Portal Client
Related:
- Add Liferay user with Portal Client

1. Create Liferay service locator
RoleServiceSoapServiceLocator locator = new RoleServiceSoapServiceLocator();
RoleServiceSoap roleService = locator
    .getPortal_RoleService(new URL("http://" + screenName + ":"
    + password + "@" + liferay_server_ip
    + ":" + liferay_server_port + "/api/secure/axis/Portal_RoleService"));

2. Add new Liferay Role
RoleSoap newrole = roleService.addRole(
    "myRole",                                            // name,
    new String[] { "en_US", " en_GB" },                  // titleMapLanguageIds,
    new String[] { "my role name us", my role name  gb },// titleMapValues,
    new String[] { "en_US", " en_GB" },            // descriptionMapLanguageIds,
    new String[] { "us description","gb description" },  // descriptionMapValues,
    1);        // role type. 1=regular, 2=site, 3=organization

3. verify created role
    i) login as Liferay Administrator
   ii) Goto > Control Panel > Portal > Roles
  iii) Check whether new Role display is the listing.

LinkWithin

Related Posts Plugin for WordPress, Blogger...