summaryrefslogtreecommitdiffstats
path: root/app/controllers/timelog_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 08:37:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 08:37:07 +0000
commite9184adafc2cf68d4fb97c664b1ff39830eff306 (patch)
tree4d7dd716fe89b8db561d06b647abc4dd71b5a4cd /app/controllers/timelog_controller.rb
parentc3a07264e41be04ed889cae71f39f687890741d1 (diff)
downloadredmine-e9184adafc2cf68d4fb97c664b1ff39830eff306.tar.gz
redmine-e9184adafc2cf68d4fb97c664b1ff39830eff306.zip
Show action not allowed for time entries in closed projects (#24297).
Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@15955 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/timelog_controller.rb')
-rw-r--r--app/controllers/timelog_controller.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 4256ff30e..6c0cd3ee6 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -19,6 +19,7 @@ class TimelogController < ApplicationController
menu_item :time_entries
before_action :find_time_entry, :only => [:show, :edit, :update]
+ before_action :check_editability, :only => [:edit, :update]
before_action :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy]
before_action :authorize, :only => [:show, :edit, :update, :bulk_edit, :bulk_update, :destroy]
@@ -221,13 +222,16 @@ class TimelogController < ApplicationController
private
def find_time_entry
@time_entry = TimeEntry.find(params[:id])
+ @project = @time_entry.project
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
+ def check_editability
unless @time_entry.editable_by?(User.current)
render_403
return false
end
- @project = @time_entry.project
- rescue ActiveRecord::RecordNotFound
- render_404
end
def find_time_entries