[DRE-commits] r4534 - trunk/redmine/debian/patches
Jérémy Lal
kapouer-guest at alioth.debian.org
Sun Jan 17 14:44:50 UTC 2010
Author: kapouer-guest
Date: 2010-01-17 14:44:49 +0000 (Sun, 17 Jan 2010)
New Revision: 4534
Added:
trunk/redmine/debian/patches/0014-REST-API-for-my-account.patch
Modified:
trunk/redmine/debian/patches/series
Log:
Add a REST API for my/account,simply returns User.current.
Added: trunk/redmine/debian/patches/0014-REST-API-for-my-account.patch
===================================================================
--- trunk/redmine/debian/patches/0014-REST-API-for-my-account.patch (rev 0)
+++ trunk/redmine/debian/patches/0014-REST-API-for-my-account.patch 2010-01-17 14:44:49 UTC (rev 4534)
@@ -0,0 +1,54 @@
+From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= <kapouer at melix.org>
+Date: Sat, 16 Jan 2010 18:21:50 +0100
+Subject: [PATCH] REST API for my/account
+
+This allows my/account.(json|xml) to return User.current.
+---
+ app/controllers/my_controller.rb | 8 ++++++--
+ config/routes.rb | 6 ++++++
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
+index f686759..f960951 100644
+--- a/app/controllers/my_controller.rb
++++ b/app/controllers/my_controller.rb
+@@ -17,7 +17,7 @@
+
+ class MyController < ApplicationController
+ before_filter :require_login
+-
++ accept_key_auth :index
+ helper :issues
+ helper :custom_fields
+
+@@ -39,7 +39,11 @@ class MyController < ApplicationController
+
+ def index
+ page
+- render :action => 'page'
++ respond_to do |format|
++ format.html { render :action => 'page' }
++ format.xml { render :xml => @user.to_xml }
++ format.json { render :json => @user.to_json }
++ end
+ end
+
+ # Show user's page
+diff --git a/config/routes.rb b/config/routes.rb
+index e2560c1..4bca52e 100644
+--- a/config/routes.rb
++++ b/config/routes.rb
+@@ -17,6 +17,12 @@ ActionController::Routing::Routes.draw do |map|
+ map.connect 'time_entries/:id/edit', :action => 'edit', :controller => 'timelog'
+ map.connect 'projects/:project_id/time_entries/new', :action => 'edit', :controller => 'timelog'
+ map.connect 'projects/:project_id/issues/:issue_id/time_entries/new', :action => 'edit', :controller => 'timelog'
++
++ map.with_options :controller => 'my' do |my_routes|
++ my_routes.with_options :conditions => {:method => :get} do |my_views|
++ my_views.connect 'my/account.:format', :action => 'index'
++ end
++ end
+
+ map.with_options :controller => 'timelog' do |timelog|
+ timelog.connect 'projects/:project_id/time_entries', :action => 'details'
+--
Modified: trunk/redmine/debian/patches/series
===================================================================
--- trunk/redmine/debian/patches/series 2010-01-16 16:46:03 UTC (rev 4533)
+++ trunk/redmine/debian/patches/series 2010-01-17 14:44:49 UTC (rev 4534)
@@ -11,3 +11,4 @@
0011-Allows-environment-variables-to-setup-debian-paths.patch
0012-Move-session-configuration-to-YML-file-next-to-datab.patch
0013-Duplicate-name-value-in-request.patch
+0014-REST-API-for-my-account.patch
More information about the Pkg-ruby-extras-commits
mailing list