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

Remove final usages of current_user_allowed_to method

Klaus Zanderse7a91fbedbe8
diff --git a/modules/bim/lib/open_project/bim/engine.rb b/modules/bim/lib/open_project/bim/engine.rb
index 744bec8adba..37455afed1f 100644
--- a/modules/bim/lib/open_project/bim/engine.rb
+++ b/modules/bim/lib/open_project/bim/engine.rb
@@ -127,7 +127,7 @@ module OpenProject::Bim
include API::Bim::Utilities::PathHelper
link :bcfTopic,
- cache_if: -> { current_user_allowed_to(:view_linked_issues) } do
+ cache_if: -> { current_user.allowed_in_project?(:view_linked_issues, represented.project) } do
next unless represented.bcf_issue?
{
@@ -136,7 +136,7 @@ module OpenProject::Bim
end
link :convertBCF,
- cache_if: -> { current_user_allowed_to(:manage_bcf) } do
+ cache_if: -> { current_user.allowed_in_project?(:manage_bcf, represented.project) } do
next if represented.bcf_issue? || represented.project.nil?
{
@@ -148,7 +148,7 @@ module OpenProject::Bim
end
links :bcfViewpoints,
- cache_if: -> { current_user_allowed_to(:view_linked_issues) } do
+ cache_if: -> { current_user.allowed_in_project?(:view_linked_issues, represented.project) } do
next unless represented.bcf_issue?
represented.bcf_issue.viewpoints.map do |viewpoint|
@@ -178,7 +178,8 @@ module OpenProject::Bim
links :bcfViewpoints do
journable = represented.journable
- next unless current_user_allowed_to(:view_linked_issues) && represented.bcf_comment.present? && journable.bcf_issue?
+ next unless current_user.allowed_in_project?(:view_linked_issues, represented.format) &&
+ represented.bcf_comment.present? && journable.bcf_issue?
# There will only be one viewpoint per comment but we nevertheless return a collection here so that it is more
# similar to the work package representer.
diff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rb
index d061bd841d8..ab1094f58b0 100644
--- a/modules/costs/lib/costs/engine.rb
+++ b/modules/costs/lib/costs/engine.rb
@@ -174,8 +174,8 @@ module Costs
link :logCosts,
cache_if: -> {
- current_user_allowed_to(:log_costs, context: represented.project) ||
- current_user_allowed_to(:log_own_costs, context: represented.project)
+ current_user.allowed_in_project?(:log_costs, context: represented.project) ||
+ current_user.allowed_in_project?(:log_own_costs, context: represented.project)
} do
next unless represented.costs_enabled? && represented.persisted?
@@ -188,8 +188,8 @@ module Costs
link :showCosts,
cache_if: -> {
- current_user_allowed_to(:view_cost_entries, context: represented.project) ||
- current_user_allowed_to(:view_own_cost_entries, context: represented.project)
+ current_user.allowed_in_project?(:view_cost_entries, context: represented.project) ||
+ current_user.allowed_in_project?(:view_own_cost_entries, context: represented.project)
} do
next unless represented.persisted? && represented.project.costs_enabled?