Removed org.policies table; policies are now handled in the org.modules[module].config table.
This commit is contained in:
@@ -20,15 +20,7 @@ function modpol.interactions.get_policy_string(
|
|||||||
local output = {}
|
local output = {}
|
||||||
if modpol.util.num_pairs(this_module.config) > 0 then
|
if modpol.util.num_pairs(this_module.config) > 0 then
|
||||||
for k, v in pairs(this_module.config) do
|
for k, v in pairs(this_module.config) do
|
||||||
local this_policy = ""
|
local this_policy = k .. " - " .. tostring(v)
|
||||||
-- org policies
|
|
||||||
if this_org.policies[module_slug]
|
|
||||||
and this_org.policies[module_slug][k] then
|
|
||||||
this_policy = k .. " - " ..
|
|
||||||
tostring(this_org.policies[module_slug][k])
|
|
||||||
else
|
|
||||||
this_policy = k .. " - " .. tostring(v)
|
|
||||||
end
|
|
||||||
table.insert(output,this_policy)
|
table.insert(output,this_policy)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -15,7 +15,6 @@ function temp_org()
|
|||||||
id = nil,
|
id = nil,
|
||||||
name = nil,
|
name = nil,
|
||||||
modules = modpol.util.copy_table(modpol.modules),
|
modules = modpol.util.copy_table(modpol.modules),
|
||||||
policies = {},
|
|
||||||
processes = {},
|
processes = {},
|
||||||
pending = {},
|
pending = {},
|
||||||
members = {},
|
members = {},
|
||||||
@@ -317,21 +316,3 @@ function modpol.orgs:get_member_count()
|
|||||||
end
|
end
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Adds a new policy to the policy table.
|
|
||||||
-- Must define the policy type, process associated with it, and whether the request must be made by an org member
|
|
||||||
-- @function modpol.orgs:set_policy
|
|
||||||
-- @param policy_type
|
|
||||||
-- @param process_type
|
|
||||||
-- @param must_be_member Boolean
|
|
||||||
function modpol.orgs:set_policy(policy_type, process_type, must_be_member)
|
|
||||||
local new_policy = {
|
|
||||||
process_type = process_type,
|
|
||||||
must_be_member = must_be_member
|
|
||||||
}
|
|
||||||
self.policies[policy_type] = new_policy
|
|
||||||
modpol.ocutil.log('Added policy for ' .. policy_type .. ' in ' .. self.name)
|
|
||||||
self:record('Added policy for ' .. policy_type, 'set_policy')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
-- @param intiator Initiator for module
|
-- @param intiator Initiator for module
|
||||||
-- @param config Config for module
|
-- @param config Config for module
|
||||||
-- @param result
|
-- @param result
|
||||||
function modpol.orgs:call_module(module_slug, initiator, config, result, parent_id)
|
function modpol.orgs:call_module(module_slug, initiator, config, result, parent_id)
|
||||||
if not modpol.modules[module_slug] then
|
if not modpol.modules[module_slug] then
|
||||||
modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. module_slug .. '" not found')
|
modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. module_slug .. '" not found')
|
||||||
return
|
return
|
||||||
@@ -15,21 +15,15 @@ function modpol.orgs:call_module(module_slug, initiator, config, result, parent_
|
|||||||
|
|
||||||
local index = #self.processes + 1
|
local index = #self.processes + 1
|
||||||
|
|
||||||
local module = modpol.modules[module_slug]
|
local module = self.modules[module_slug]
|
||||||
|
|
||||||
-- sets default values for undeclared config variables
|
|
||||||
-- first applies any relevant org policies
|
-- first applies any relevant org policies
|
||||||
-- then overrides with the config values given on input
|
-- then overrides with the config values given on input
|
||||||
local new_config = {}
|
local new_config = {}
|
||||||
if modpol.util.num_pairs(module.config) > 0 then
|
if modpol.util.num_pairs(module.config) > 0 then
|
||||||
for k, v in pairs(module.config) do
|
for k, v in pairs(module.config) do
|
||||||
new_config[k] = v
|
new_config[k] = v
|
||||||
-- org policies
|
-- overrides with input settings
|
||||||
if self.policies[module_slug]
|
|
||||||
and self.policies[module_slug][k] then
|
|
||||||
new_config[k] = self.policies[module_slug][k]
|
|
||||||
end
|
|
||||||
-- input settings
|
|
||||||
if config and config[k] then
|
if config and config[k] then
|
||||||
new_config[k] = config[k]
|
new_config[k] = config[k]
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user