liferay - How to retrieve all the Groups/Roles a user is member of using SOAP services? -
i trying collect user informations using soap services.
i able job title given user, don't understand how retrieve list of groups , roles user has.
can use groupservicesoap.getuserplaces(long userid, string[] classnames, int max)
method? or there way can these fields?
currently code:
private static url _geturl(string remoteuser, string password, string servicename) { final string liferay_protocol = "http://"; final string liferay_tcp_port = "8080"; final string liferay_fqdn = "localhost"; final string liferay_axis_path = "/api/secure/axis/"; try { return new url(liferay_protocol + urlencoder.encode(remoteuser, "utf-8") + ":" + urlencoder.encode(password, "utf-8") + "@" + liferay_fqdn + ":" + liferay_tcp_port + liferay_axis_path + servicename); } catch (malformedurlexception e) { return null; } catch (unsupportedencodingexception e) { return null; } } [...] public static void main(string[] argv){ public final string liferay_user_service="portal_userservice"; public final string liferay_company_service="portal_companyservice"; public final string liferay_group_service = "portal_groupservice"; //company.default.web.id property public final string liferay_default_company_id = "liferay.com"; userservicesoap userservice = new userservicesoapservicelocator().getportal_userservice(_geturl(user_identifier,user_password, liferay_user_service)); //this code usefull if want use soap setter. //((portal_userservicesoapbindingstub) userservice).setusername(user_identifier); //((portal_userservicesoapbindingstub) userservice).setpassword(user_password); companyservicesoap companyservice = new companyservicesoapservicelocator().getportal_companyservice(_geturl(user_identifier, user_password, liferay_company_service)); long companyid = companyservice.getcompanybymx(liferay_default_company_id).getcompanyid(); // here retrieve user, , can access properties, not them ! usersoap user = userservice.getuserbyemailaddress(companyid, target_user_mail); //todo : got hte jobtittle want, later more util thant print it, swear precious ! system.out.println(user.getjobtitle()); groupservicesoap groupservice = new groupservicesoapservicelocator().getportal_groupservice(_geturl(user_identifier, user_password, liferay_group_service)); //this 1 return empty array groupsoap[] userplaces = groupservice.getuserplaces(new string[]{"group", "role"}, 150); //this return array of size 1, groupsoap seems structural groups without usefull properties me. groupsoap[] userplaces = groupservice.getuserplaces(null, 150); }
use method user role , group user id
userservicesoap.getroleuserids userservicesoap.getgroupuserids
hth
Comments
Post a Comment