Hellow everyone. I've got a problem with permissions in sharepoint. I'm trying to make a call to the HttpHandler to create new QueryRule. But when I do this:
var queryRule = queryRules.CreateQueryRule(string.Format("{0} - {1}", rule.Title, rule._Keywords), null, null, true);
I get an exception with the message "Attempted to perform unauthorized operation". I've tried everything, recreated Web object on System Account's behalf, tried to use elevated privileges and even impersonation like here - http://stackoverflow.com/questions/7710538/impersonate-with-username-and-password. As far as I understand the main reason for this is that the request comes from a user from web application other than Central Administration. And from what I see in Microsoft.Office.Search.Server assembly, I need to impersonate the user in Thread.CurrentPrincipal to pass the permissions check. Can somebody help me with this?