Author: tchemit Date: 2014-04-15 22:02:56 +0200 (Tue, 15 Apr 2014) New Revision: 432 Url: http://forge.nuiton.org/projects/jredmine/repository/revisions/432 Log: refs-20 #2381 (add method get_current_user in redmine rails plugin) Modified: trunk/jredmine-client/src/main/redmine/jredmine-2.x/app/controllers/jredmine_controller.rb trunk/jredmine-client/src/main/redmine/jredmine-2.x/config/routes.rb Modified: trunk/jredmine-client/src/main/redmine/jredmine-2.x/app/controllers/jredmine_controller.rb =================================================================== --- trunk/jredmine-client/src/main/redmine/jredmine-2.x/app/controllers/jredmine_controller.rb 2014-04-15 18:51:13 UTC (rev 431) +++ trunk/jredmine-client/src/main/redmine/jredmine-2.x/app/controllers/jredmine_controller.rb 2014-04-15 20:02:56 UTC (rev 432) @@ -31,7 +31,7 @@ before_filter :try_find_current_user # check user exists - before_filter :check_current_user, :only => [:get_user_projects, :add_version, :update_version, :next_version, :add_news, :add_attachment, :add_version_attachment, :add_issue_time, :update_issue_time] + before_filter :check_current_user, :only => [:get_current_user, :get_user_projects, :add_version, :update_version, :next_version, :add_news, :add_attachment, :add_version_attachment, :add_issue_time, :update_issue_time] # find project and check permission before_filter :find_project, :except => [:ping, :get_projects, :get_user_projects, :get_issue_statuses, :get_issue_priorities, :get_enumeration] @@ -70,6 +70,10 @@ render_array_result result, "projects" end + def get_current_user + User.current + end + # recuperation des priorities d'issues def get_issue_priorities get_enumeration "IssuePriority" Modified: trunk/jredmine-client/src/main/redmine/jredmine-2.x/config/routes.rb =================================================================== --- trunk/jredmine-client/src/main/redmine/jredmine-2.x/config/routes.rb 2014-04-15 18:51:13 UTC (rev 431) +++ trunk/jredmine-client/src/main/redmine/jredmine-2.x/config/routes.rb 2014-04-15 20:02:56 UTC (rev 432) @@ -25,9 +25,9 @@ RedmineApp::Application.routes.draw do # jredmine : actions with no project context - match 'jredmine/:action.xml', :to => 'jredmine#:action', :action => ['get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'xml', :via => ['get'] - match 'jredmine/:action.json', :to => 'jredmine#:action', :action => ['get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'json', :via => ['get'] - match 'jredmine/:action', :to => 'jredmine#:action', :action => ['ping', 'get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'xml', :via => ['get'] + match 'jredmine/:action.xml', :to => 'jredmine#:action', :action => ['get_current_user', 'get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'xml', :via => ['get'] + match 'jredmine/:action.json', :to => 'jredmine#:action', :action => ['get_current_user', 'get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'json', :via => ['get'] + match 'jredmine/:action', :to => 'jredmine#:action', :action => ['get_current_user', 'ping', 'get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'xml', :via => ['get'] # jredmine/action/:pid : actions with project context match 'jredmine/:action.xml/:pid', :to=> 'jredmine#:action', :pid => /.+/, :format => 'xml', :via => ['get', 'post']