standardizing org template
This commit is contained in:
parent
6073732e6c
commit
90da4c70bb
@ -7,6 +7,18 @@ modpol.orgs =
|
||||
-- sets modpol.orgs as its own fallback
|
||||
modpol.orgs.__index = modpol.orgs
|
||||
|
||||
function temp_org()
|
||||
return {
|
||||
id = nil,
|
||||
name = nil,
|
||||
policies = {},
|
||||
processes = {},
|
||||
members = {},
|
||||
parent = nil,
|
||||
children = {}
|
||||
}
|
||||
end
|
||||
|
||||
-- ==================================================
|
||||
-- returns org when given its id or name
|
||||
function modpol.orgs.get_org(arg)
|
||||
@ -74,17 +86,10 @@ function modpol.orgs.init_instance()
|
||||
return false, error_msg
|
||||
end
|
||||
|
||||
local instance = {
|
||||
id = 1,
|
||||
name = "instance",
|
||||
policies = {},
|
||||
members = {},
|
||||
ledger = {},
|
||||
parent = nil,
|
||||
children = {},
|
||||
properties = {},
|
||||
old_names = {}
|
||||
}
|
||||
local instance = temp_org()
|
||||
instance.id = 1
|
||||
instance.name = "instance"
|
||||
|
||||
setmetatable(instance, modpol.orgs)
|
||||
|
||||
-- adding instance to org list
|
||||
@ -146,14 +151,11 @@ function modpol.orgs:add_org(name)
|
||||
|
||||
-- creating the child sub org
|
||||
modpol.orgs.count = modpol.orgs.count + 1
|
||||
local child_org = {
|
||||
id = modpol.orgs.count,
|
||||
name = name,
|
||||
policies = {},
|
||||
members = {},
|
||||
parent = self.id,
|
||||
children = {},
|
||||
}
|
||||
local child_org = temp_org()
|
||||
child_org.id = modpol.orgs.count
|
||||
child_org.name = name
|
||||
child_org.parent = self.id
|
||||
|
||||
setmetatable(child_org, modpol.orgs)
|
||||
|
||||
-- adding child id to list of children
|
||||
|
Loading…
x
Reference in New Issue
Block a user