Prevent stripping of permissions before disabled modules registered

The +remove_modules_permissions+ is called before the disabled modules
are registered.

https://community.openproject.org/wp/43213
This commit is contained in:
Oliver Günther
2022-07-21 16:24:12 +02:00
parent 823cc6ac21
commit 0a359d5051
2 changed files with 4 additions and 7 deletions
+2 -1
View File
@@ -26,9 +26,10 @@
# See COPYRIGHT and LICENSE files for more details.
#++
Rails.application.config.after_initialize do
Rails.application.config.to_prepare do
if OpenProject::Configuration.disabled_modules.any?
to_disable = OpenProject::Configuration.disabled_modules
OpenProject::Plugins::ModuleHandler.disable_modules(to_disable)
OpenProject::Plugins::ModuleHandler.enforce!
end
end
+2 -6
View File
@@ -35,15 +35,11 @@ module OpenProject::Plugins
@@disabled_modules += Array(module_names).map(&:to_sym)
end
def disable(disabled_modules)
disabled_modules.map do |module_name|
def enforce!
@@disabled_modules.map do |module_name|
OpenProject::AccessControl.remove_modules_permissions(module_name)
end
end
end
OpenProject::Application.config.to_prepare do
OpenProject::Plugins::ModuleHandler.disable(@@disabled_modules)
end
end
end