diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-26 20:41:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-26 20:41:12 +0000 |
commit | e7c0e16a3ff68681cb475fa382d843c0977a7c09 (patch) | |
tree | 0054114634a6b4e2dd3cc1aaf39a7c8e88a95c50 /app/controllers/application_controller.rb | |
parent | 339a6212effb4ac1a9e17ff3059c67439a957928 (diff) | |
download | redmine-e7c0e16a3ff68681cb475fa382d843c0977a7c09.tar.gz redmine-e7c0e16a3ff68681cb475fa382d843c0977a7c09.zip |
Use regular #authorize method.
git-svn-id: http://svn.redmine.org/redmine/trunk@16724 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1d42901f0..1b5a74da2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -285,8 +285,16 @@ class ApplicationController < ActionController::Base render_404 end + # Find project of id params[:id] if present + def find_optional_project_by_id + if params[:id].present? + @project = Project.find(params[:id]) + end + rescue ActiveRecord::RecordNotFound + render_404 + end + # Find a project based on params[:project_id] - # TODO: some subclasses override this, see about merging their logic def find_optional_project @project = Project.find(params[:project_id]) unless params[:project_id].blank? allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true) |