Hi,

I am trying to update comment from default service call. I am passing session in header of logged in user due to this drupal service will consider that user as logged in user and update comment by that user name.

Here is my code,

var obj = {
//"subject":"liJmJfpqMX",
"comment_body":{"und":[{"value":" updated ..this is comment is from rest service.."}]},
"cid":cid
};
$.ajax({
url: "MY_SITE_URL/my_services/comment/"+ 89+".json",
headers: {
"session": "SESS49960de5880e8c687434170f6476605b=m4Lw6KqhPCnnN7ni9IgGA4eaoyWeI7YwWOEbFPoPnpw",
"Cookie": "SESS49960de5880e8c687434170f6476605b=m4Lw6KqhPCnnN7ni9IgGA4eaoyWeI7YwWOEbFPoPnpw",
},
crossDomain: true,
type: 'PUT',
ContentType: "application/json",
"data" : obj,
dataType: 'json',
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('VIew Comment - failed to show'+ textStatus + errorThrown);
},
success: function (data) {
alert("Success :) ");
}
});
}

In above code I am passing session to one user(A) and given comment is of user is posted by another user(B), once i run this code comment is updated and author is set to user A.

But as per pemissions i set only author can update self comments.

Please suggest me solution!!!

Thanks in advance!!

Comments

kylebrowning’s picture

Category: Bug report » Support request

You haven't passed the author of the comment, so its automatically updated to user A, because USER A is the one updating the comment.

marcingy’s picture

Priority: Major » Normal
marcingy’s picture

Status: Active » Postponed (maintainer needs more info)
Madhuri A’s picture

But after running above code it should have to give error like 'Access denied.'

Can you please update the code to pass author?

Madhuri A’s picture

Passing author like,

var obj = {
"subject":"testing comment...",
"comment_body":{"und":[{"value":" Testing......."}]},
"cid":cid,
"uid":23060
};

but not useful.

kylebrowning’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Madhuri A’s picture

Status: Closed (cannot reproduce) » Needs work
marcingy’s picture

Status: Needs work » Active

There is no patch so this is simply active

kylebrowning’s picture

Status: Active » Closed (cannot reproduce)

Cleaning issue queue, if you want to work on this, re-open the ticket.