Project

General

Profile

Actions

Defect #9370

closed

Modifying time_entry gives 403 forbidden

Added by Pasi Oja-Nisula about 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
2011-10-04
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

I'm trying to modify a time entry. Here's the test program.

-------------------
from pyactiveresource.activeresource import ActiveResource

class TimeEntry(ActiveResource):
    _site = 'https://redmine.goodsign.fi'
    _user = 'myusername'
    _password = 'mypassword'
    _request_format = 'xml'

time_entries = TimeEntry.find()
print time_entries
entry = time_entries[0]
print entry.comments
entry.comments = "tesmi2" 
entry.save()
-------------------

Redmine log shows this:

Processing TimelogController#index to xml (for 172.23.195.2 at 2011-10-04 10:23:14) [GET]
Parameters: {"format"=>"xml", "action"=>"index", "controller"=>"timelog"}
Rendering timelog/index
Completed in 30ms (View: 2, DB: 9) | 200 OK [https://redmine.goodsign.fi/time_entries.xml]

Processing TimelogController#update to xml (for 172.23.195.2 at 2011-10-04 10:23:15) [PUT]
Parameters: {"time_entry"=>{"comments"=>"tesmi2", "created_on"=>"2011-10-04T09:32:46+03:00", "activity"=>{"name"=>"Development", "id"=>"9"}, "id"=>"28", "project"=>{"name"=>"Test", "id"=>"7"}, "updated_on"=>"2011-10-04T09:32:46+03:00", "spent_on"=>"2011-10-04", "issue"=>{"id"=>"5047"}, "hours"=>"1.0", "user"=>{"name"=>"Pasi Oja-Nisula", "id"=>"4"}}, "format"=>"xml", "action"=>"update", "id"=>"28", "controller"=>"timelog"}
Filter chain halted as [:find_time_entry] rendered_or_redirected.
Completed in 16ms (View: 0, DB: 4) | 403 Forbidden [https://redmine.goodsign.fi/time_entries/28.xml]

Thanks!

Actions #1

Updated by Etienne Massip about 13 years ago

Are you sure that your user is allowed to see the time entry when going through application screens?

Actions #2

Updated by Pasi Oja-Nisula about 13 years ago

  • Status changed from New to Resolved

You have good eye for newbie errors. I was trying to do too many things which I don't understand. When I skipped the activeresource part and tried with curl, I got this to work. Here's the working example.

echo '<time-entry><issue_id>5047</issue_id><hours>1.5</hours><activity_id>9</activity_id><comments>tesmi6</comments></time-entry>' | curl k -u myusername:mypassword -X PUT -H 'Content-type: text/xml' -H 'Accept: text/xml' -d @ https://redmine.goodsign.fi/time_entries/28.xml

Thanks!

Actions #3

Updated by Etienne Massip about 13 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Invalid
Actions #4

Updated by Raynard Rodman about 13 years ago

SPAM

Actions

Also available in: Atom PDF