Refactored policy structure
Previously, all modules in an org were fully copied into that org. Now, the only copy of the modules is at modpol.modules, and orgs have a policy table at [org].policies, which overrides the config table in any given module.
This commit is contained in:
@ -33,7 +33,7 @@ function change_modules:initiate(result)
|
||||
for k, module in pairs(modpol.modules) do
|
||||
if not modpol.modules[module.slug].hide then
|
||||
local in_org = false
|
||||
if self.org.modules[module.slug] then
|
||||
if self.org.policies[module.slug] then
|
||||
in_org = true
|
||||
end
|
||||
table.insert(
|
||||
@ -97,14 +97,13 @@ end
|
||||
function change_modules:implement_change()
|
||||
for i,v in ipairs(self.data.add_modules) do
|
||||
local slug = string.match(v,"%[(.+)%]")
|
||||
self.org.modules[slug] =
|
||||
modpol.util.copy_table(modpol.modules[slug])
|
||||
table.sort(self.org.modules)
|
||||
self.org.policies[slug] = {}
|
||||
table.sort(self.org.policies)
|
||||
end
|
||||
for i,v in ipairs(self.data.remove_modules) do
|
||||
local slug = string.match(v,"%[(.+)%]")
|
||||
self.org.modules[slug] = nil
|
||||
table.sort(self.org.modules)
|
||||
self.org.policies[slug] = nil
|
||||
table.sort(self.org.policies)
|
||||
end
|
||||
-- announce and shut down
|
||||
modpol.interactions.message_org(
|
||||
|
Reference in New Issue
Block a user