RE: Issue with update-ratings-entry?

László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
Hi!
I use RatingScreenlet to rate the article, by article's entryId. I can get ratings data from server by using get-rating-entries service. The result is:
{ "average": 0.46666666666666673, 
  "classPK": "110114", 
  "ratings": [ 3 ], 
  "className": "com.liferay.journal.model.JournalArticle", 
  "userScore": 0.2, 
  "totalCount": 3, 
  "totalScore": 1.4000000000000001 } 
But, when I modify the rating for the article with update-ratings-entry I must use classPK and className not the entryId only. I give to the update the data that the get-entries given and it fails with the following error: 
User 148509 must have UPDATE permission for 110114
We don't want to add any user the UPDATE permission to a simple user.I think the className and/or classPK is wrong in the server response.
What should I give to those parameters?
Thanks!
 
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Hey Laszlo,Can you show us what you are passing as the as he payload when you call the update-ratings-entry?
László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
I use the jsonws api. On /screens.screensratingsentry/get-ratings-entries form I fill the following parameters
p_auth String - this is fix, authenticated user's token
assetEnryId  long - 110120, valid article's entryId, I got it from the webContent 
ratingsLength int - 1
The result of this call I get the result JSON that I attached above. From the result JSON I copy the params into the /screens.screensratingsentry/update-ratings-entry form: 
p_auth  String  - this is fix, authenticated user's token same as what is in the get-ratings-entries
classPK long - from get-ratings-entries result classPK value, as above: 110114
className java.lang.String  - from get-ratings-entries result className value, as above: com.liferay.journal.model.JournalArticle 
Result double - the user's rating, for example: 0.2
ratingsLength int - 1
The result is I mentioned above. 
thumbnail
Javier Gamarra, modified 6 Years ago. Expert Posts: 348 Join Date: 2/12/15 Recent Posts
You are right, the permission check is wrong, sent a PR fixing it. Meanwhile I recommend you to use your own interactor with your service (or the already existing update rating one)
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Beat me to it -- but I would not have had the recommendation for the own interactor, so thanks for sharing Javier. When you get a minute, can you reply with a link to the PR -- just in case anyone comes along and wants to see the changes you are proposing?
thumbnail
Javier Gamarra, modified 6 Years ago. Expert Posts: 348 Join Date: 2/12/15 Recent Posts
László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
Thank you, It works!