Browse Source

Removed org.policies table; policies are now handled in the org.modules[module].config table.

Nathan Schneider 2 years ago
parent
commit
8086b18879

+ 1 - 9
modpol_core/interactions/interactions.lua

@@ -20,15 +20,7 @@ function modpol.interactions.get_policy_string(
    local output = {}
     if modpol.util.num_pairs(this_module.config) > 0 then
        for k, v in pairs(this_module.config) do
-          local this_policy = ""
-          -- 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
+          local this_policy = k .. " - " .. tostring(v)
           table.insert(output,this_policy)
        end
     end

+ 0 - 19
modpol_core/orgs/base.lua

@@ -15,7 +15,6 @@ function temp_org()
         id = nil,
         name = nil,
         modules = modpol.util.copy_table(modpol.modules),
-        policies = {},
         processes = {},
         pending = {},
         members = {},
@@ -317,21 +316,3 @@ function modpol.orgs:get_member_count()
     end
     return count
 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
-
-

+ 3 - 9
modpol_core/orgs/process.lua

@@ -7,7 +7,7 @@
 -- @param intiator Initiator for module
 -- @param config Config for module
 -- @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
         modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. module_slug .. '" not found')
         return
@@ -15,21 +15,15 @@ function modpol.orgs:call_module(module_slug, initiator, config, result, parent_
 
     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
     -- then overrides with the config values given on input
     local new_config = {}
     if modpol.util.num_pairs(module.config) > 0 then
        for k, v in pairs(module.config) do
           new_config[k] = v
-          -- org policies
-          if self.policies[module_slug]
-             and self.policies[module_slug][k] then
-             new_config[k] = self.policies[module_slug][k]
-          end
-          -- input settings
+          -- overrides with input settings
           if config and config[k] then
              new_config[k] = config[k]
           end