Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jeremy Place
getUserGroupUsers Soap Service
May 30, 2013 8:58 AM
Answer

Jeremy Place

Rank: New Member

Posts: 10

Join Date: March 29, 2013

Recent Posts

I'm browsing the Portal_UserService, hoping to retrieve a User Group membership list.

If I submit the userGroupId (in fact any id) to getUserGroupUsers (Portal_UserService) I get
1            <faultcode>soapenv:Server.userException</faultcode>
2            <faultstring>java.rmi.RemoteException</faultstring>


with the console

115:50:08,232 ERROR [http-bio-8080-exec-24][UserServiceSoap:872] com.liferay.portal.security.auth.PrincipalException
2com.liferay.portal.security.auth.PrincipalException


I can get a user's member-of attribute from getUserUserGroups (Portal_UserGroupService) which returns a userGroupId, successfully.

Anyone manage to use getUserGroupUsers successfully?
Antoine Comble
RE: getUserGroupUsers Soap Service
June 12, 2013 8:59 AM
Answer

Antoine Comble

Rank: Regular Member

Posts: 216

Join Date: September 7, 2012

Recent Posts

Hi,

Do you use tunnel-web secure connection when you call the Portal_UserService service ?

Otherwise, you can edit the portal.xml file store in the ROOT/WEB-INF/lib/portal-impl.jar/resource-actions folder.
Search the com.liferay.portal.model.UserGroup xml node and replace the permissions node by this :
 1<permissions>
 2            <supports>
 3                <action-key>ASSIGN_MEMBERS</action-key>
 4                <action-key>DELETE</action-key>
 5                <action-key>MANAGE_ANNOUNCEMENTS</action-key>
 6                <action-key>PERMISSIONS</action-key>
 7                <action-key>UPDATE</action-key>
 8                <action-key>VIEW</action-key>
 9                               <action-key>VIEW_MEMBERS</action-key>
10            </supports>
11            <site-member-defaults />
12            <guest-defaults />
13            <guest-unsupported>
14                <action-key>ASSIGN_MEMBERS</action-key>
15                <action-key>DELETE</action-key>
16                <action-key>MANAGE_ANNOUNCEMENTS</action-key>
17                <action-key>PERMISSIONS</action-key>
18                <action-key>UPDATE</action-key>
19                <action-key>VIEW</action-key>
20                                <action-key>VIEW_MEMBERS</action-key>
21            </guest-unsupported>
22        </permissions>

Hope this help you,
Jeremy Place
RE: getUserGroupUsers Soap Service
June 12, 2013 12:05 PM
Answer

Jeremy Place

Rank: New Member

Posts: 10

Join Date: March 29, 2013

Recent Posts

Bump. Anyone use this Web Service?
Oliver Bayer
RE: getUserGroupUsers Soap Service
June 13, 2013 1:27 AM
Answer

Oliver Bayer

Rank: Liferay Master

Posts: 880

Join Date: February 18, 2009

Recent Posts

Hi Jeremy,

I've never used these webservices but a "PrincipalException" means that there is an error regarding the authentication.
So must be authenticated before accessing this webservice so you've either missed to give the credentials (user + login) or you've a problem during authentication. I've read some similar posts so try to search the forums.

HTH Oli
Jeremy Place
RE: getUserGroupUsers Soap Service
June 13, 2013 2:14 AM
Answer

Jeremy Place

Rank: New Member

Posts: 10

Join Date: March 29, 2013

Recent Posts

Thanks for the comments.
Currently I am using both Oxygen WSDL SOAP Analyzer tool and Eclipse Web Services Explorer (Liferay SDK) to examine the web services of a Liferay v6.1 CE Server (Tomcat 7) bundle.
Looking at ~/api/secure/axis/Portal_UserGroupService
I authenticate using http credentials of a Super User and can successfully query getUserGroup on example userGroupId 16417.
But when I look at ~/api/secure/axis/Portal_UserService and query getUserGroupUsers on the same userGroupId 16417 I get the PrincipalExecpetion on UserServiceSoap
I can successfully query other actions, such as getUserById, from Portal_UserService.
Maybe the permissions for querying User Group membership are different to other services?
Antoine Comble
RE: getUserGroupUsers Soap Service
June 13, 2013 3:00 AM
Answer

Antoine Comble

Rank: Regular Member

Posts: 216

Join Date: September 7, 2012

Recent Posts

With the following code, it works for me !
 1
 2// user service
 3final UserServiceSoapServiceLocator locatorUser = new UserServiceSoapServiceLocator();
 4serviceUser = locatorUser.getPortal_UserService(getURL("http://localhost:8080", "Portal_UserService"));
 5((Portal_UserServiceSoapBindingStub) serviceUser).setUsername(liferayAdminLogin);
 6((Portal_UserServiceSoapBindingStub) serviceUser).setPassword(liferayAdminPassword);
 7
 8protected static URL getURL(final String server, final String serviceName) throws MalformedURLException {
 9        final StringBuilder sb = new StringBuilder();
10        sb.append(server);
11        sb.append("/api/secure/axis/");
12        sb.append(serviceName);
13        return new URL(sb.toString());
14}
15
16serviceUser.getUserGroupUsers(userGroupId);


Hope this help you.
Jeremy Place
RE: getUserGroupUsers Soap Service
June 14, 2013 6:51 AM
Answer

Jeremy Place

Rank: New Member

Posts: 10

Join Date: March 29, 2013

Recent Posts

Thanks very much Antoine

I took your advice from above and added the VIEW_MEMBERS action-key to the portal.xml and now it works emoticon

I didn't try it initially coz I wasn't sure whether it was an either/or between secure api or portal.xml, and as I have a hosting agreement I'll need to see if my hosting provider is happy to edit the file. Do you know if there's a way to set this parameter without editing the contents of the jar?