Forums

Home » Mobile » Liferay Mobile SDK

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Vishnudas Lokhande
Accessing json web services using user credentials
June 12, 2014 6:48 AM
Answer

Vishnudas Lokhande

Rank: Regular Member

Posts: 148

Join Date: May 27, 2013

Recent Posts

HI all,

In my liferay android app i am calling json web services .
when i am giving admin credentials for auth then it works fine..

Now i want to call services using normal user credentials..but i am getting access/permissions related error.
I tried with this property..
jsonws.web.service.public.methods=*
But could not call even public methods also..


MY questions
1) how can we call services using normal site user crendentials?

2)And is it required to give portal user credentials for calling lr json web services.
Bruno Farache
RE: Accessing json web services using user credentials
June 12, 2014 9:04 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 602

Join Date: May 14, 2007

Recent Posts

Which service are you calling, Lokhande? Maybe this is happening because your user doesn't have permission to call this service.
Vishnudas Lokhande
RE: Accessing json web services using user credentials
June 12, 2014 9:48 PM
Answer

Vishnudas Lokhande

Rank: Regular Member

Posts: 148

Join Date: May 27, 2013

Recent Posts

Hi bruno,

I am calling UserService,GroupService..

Yes it is happening because user doesn't have permission to call thiese services.

How i will get to know user has permisson or not?

And can only admin call services.

As per this property..jsonws.web.service.public.methods=*
we can call services without authentication.
Bruno Farache
RE: Accessing json web services using user credentials
June 13, 2014 4:12 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 602

Join Date: May 14, 2007

Recent Posts

You need to give permissions in the portal. This portal property is not related.

Which methods are you calling from user and group service?
Vishnudas Lokhande
RE: Accessing json web services using user credentials
June 15, 2014 10:29 PM
Answer

Vishnudas Lokhande

Rank: Regular Member

Posts: 148

Join Date: May 27, 2013

Recent Posts

i am calling these service methods..getUserSites() , getGroupUsers .
Bruno Farache
RE: Accessing json web services using user credentials
June 16, 2014 4:20 AM
Answer

Bruno Farache

LIFERAY STAFF

Rank: Liferay Master

Posts: 602

Join Date: May 14, 2007

Recent Posts

Are you sure you are getting permission exceptions when calling getUserSites()? You shouldn't, because there's not permission being checked for this method.

You are probably getting permission exception with getGroupUsers only, this method requires the user to have "view members" permission. That is, you must give him permission to view other Site members in the portal, the link I gave you previously explains how to set permissions in the portal, you must look for the "View Members" action and give that permissions the user's role.
Vishnudas Lokhande
RE: Accessing json web services using user credentials
June 16, 2014 10:46 PM
Answer

Vishnudas Lokhande

Rank: Regular Member

Posts: 148

Join Date: May 27, 2013

Recent Posts

Thanks Bruno!!!!

I gave view members permission to that user role..And it's working fine..

I got it..