Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix context menu permission check for time entry lists

Klaus Zanders35db476569e5
diff --git a/modules/costs/app/components/my/time_tracking/time_entry_row.rb b/modules/costs/app/components/my/time_tracking/time_entry_row.rb
index e74220f1d29..c28f5333d33 100644
--- a/modules/costs/app/components/my/time_tracking/time_entry_row.rb
+++ b/modules/costs/app/components/my/time_tracking/time_entry_row.rb
@@ -38,7 +38,7 @@ module My
end
def action_menu
- return nil unless User.current.allowed_in_work_package?(:edit_own_time_entries, time_entry.work_package)
+ return nil if !(can_modify_time_entry? || can_delete_time_entry?)
render(Primer::Alpha::ActionMenu.new) do |menu|
menu.with_show_button(icon: "kebab-horizontal", "aria-label": t("label_more"), scheme: :invisible)
@@ -179,6 +179,10 @@ module My
def can_delete_time_entry?
TimeEntries::DeleteContract.new(time_entry, User.current).valid?
end
+
+ def can_modify_time_entry?
+ TimeEntries::UpdateContract.new(time_entry, User.current).valid?
+ end
end
end
end