Sunday, December 29, 2013

How to assign Role to a User with Liferay Portal Client

Assigning regular role

RoleServiceSoapServiceLocator locator = new RoleServiceSoapServiceLocator();

RoleServiceSoap service = locator.getPortal_RoleService(new URL("http://username:password@localhost:8080/api/secure/axis/Portal_RoleService"));

service.addUserRoles(userId, roleIds);

Assigning site role

UserGroupRoleServiceSoapServiceLocator locator = new UserGroupRoleServiceSoapServiceLocator();

UserGroupRoleServiceSoap service = locator.getPortal_UserGroupRoleService(new URL("http://username:password@localhost:8080/api/secure/axis/Portal_UserGroupRoleService"));

service.addUserGroupRoles(userId, siteId, roleIds);


Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...