Two months ago I wrote about my unsuccessful attempts trying to impersonate users in call into the SharePoint 2010 social API. At that time I was not able to show you the way to achieve this, and asked the help of the readers to point to the right direction.
Fortunately, Andres Ciampo wrote a comment to that post including a code snippet that seems to do the job of the impersonation.
The trick in this solution is to create a custom, impersonated HttpContext, that is set as the current context and used to create the SPServiceContext that is passed to the SocialRatingManager constructor, as illustrated in this code:
I verified the result using the GetRatingsAndCommentsForListItem method (see my former post for its code) and it proves the rating was really set in the name of the impersonated user.
Andres, thanks again for the idea and sharing the code with us!