only show menu item if user can log time

This commit is contained in:
Jens Kraemer
2020-04-24 17:22:45 +08:00
parent 20ccbba2c1
commit ba92f9fc30

View File

@@ -16,7 +16,7 @@ Redmine::Plugin.register :stopwatch do
caption: :button_log_time, caption: :button_log_time,
html: { method: :get, id: 'stopwatch-toggle', 'data-remote': true }, html: { method: :get, id: 'stopwatch-toggle', 'data-remote': true },
before: :my_account, before: :my_account,
if: ->(*_){ User.current.logged? } if: ->(*_){ User.current.logged? and User.current.allowed_to?(:log_time, nil, global: true) }
end end
Rails.configuration.to_prepare do Rails.configuration.to_prepare do