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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Allow to disable (= hide) bim module
Oliver Günther52958b1ac22c
diff --git a/lib/open_project/access_control.rb b/lib/open_project/access_control.rbindex d3c460a4200..0323344cb3b 100644--- a/lib/open_project/access_control.rb+++ b/lib/open_project/access_control.rb@@ -90,9 +90,18 @@ module OpenProjectenddef available_project_modules- @available_project_modules ||= (- @permissions.map(&:project_module) + @project_modules_without_permissions- ).uniq.compact+ @available_project_modules ||= begin+ (@permissions.map(&:project_module) + @project_modules_without_permissions)+ .uniq+ .compact+ .reject { |name| disabled_project_modules.include? name }+ end+ end++ def disabled_project_modules+ @disabled_project_modules ||= modules+ .select { |entry| entry[:if].respond_to?(:call) && !entry[:if].call }+ .map { |entry| entry[:name].to_sym }enddef modules_permissions(modules)diff --git a/lib/open_project/configuration/helpers.rb b/lib/open_project/configuration/helpers.rbindex c7856c65d8b..712868a434b 100644--- a/lib/open_project/configuration/helpers.rb+++ b/lib/open_project/configuration/helpers.rb@@ -80,7 +80,7 @@ module OpenProject### Whether we're running a bim editiondef bim?- ENV['OPENPROJECT_EDITION'] == 'bim'+ self['edition'] == 'bim'end##diff --git a/modules/bim/lib/open_project/bim/engine.rb b/modules/bim/lib/open_project/bim/engine.rbindex 5bc5cabfb28..181985812bc 100644--- a/modules/bim/lib/open_project/bim/engine.rb+++ b/modules/bim/lib/open_project/bim/engine.rb@@ -42,7 +42,8 @@ module OpenProject::Bimdefault: {}} do- project_module :bim do+ project_module(:bim,+ if: ->(*) { OpenProject::Configuration.bim? }) dopermission :view_ifc_models,{'bim/ifc_models/ifc_models': %i[index show defaults]}permission :manage_ifc_models,