mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Simplify the OpenProject::Plugins::ModuleHandler class
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
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!
|
||||
OpenProject::Plugins::ModuleHandler.disable_modules!(to_disable)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,12 +31,8 @@ module OpenProject::Plugins
|
||||
@@disabled_modules = []
|
||||
|
||||
class << self
|
||||
def disable_modules(module_names)
|
||||
@@disabled_modules += Array(module_names).map(&:to_sym)
|
||||
end
|
||||
|
||||
def enforce!
|
||||
@@disabled_modules.map do |module_name|
|
||||
def disable_modules!(module_names)
|
||||
@@disabled_modules += Array(module_names).map(&:to_sym).each do |module_name|
|
||||
OpenProject::AccessControl.remove_modules_permissions(module_name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,8 +31,7 @@ describe OpenProject::Plugins::ModuleHandler do
|
||||
let!(:all_former_permissions) { OpenProject::AccessControl.permissions }
|
||||
|
||||
before do
|
||||
disabled_modules = OpenProject::Plugins::ModuleHandler.disable_modules('repository')
|
||||
OpenProject::Plugins::ModuleHandler.disable(disabled_modules)
|
||||
described_class.disable_modules!('repository')
|
||||
end
|
||||
|
||||
after do
|
||||
|
||||
Reference in New Issue
Block a user