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