Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Issue with update-ratings-entry?
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:
What should I give to those parameters?
Thanks!
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!
Hey Laszlo,Can you show us what you are passing as the as he payload when you call the update-ratings-entry?
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.
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.
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)
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?
Thank you, It works!
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™