change orgs to use id numbers as their table key and function input param

This commit is contained in:
MisterE123
2021-03-08 14:06:15 -05:00
parent 418926f551
commit 419fc84822
5 changed files with 228 additions and 93 deletions

View File

@ -4,7 +4,7 @@ they are *not* just a message in a table anymore... they have a timestamp and mo
===============
Orgs are stored in modpol.orgs by the key 'org_name'
Orgs are stored in modpol.orgs by the key 'org_id', a unique integer
Old ledgers of deleted orgs are stored in modpol.old_ledgers,
if preserve records is enabled
@ -36,8 +36,8 @@ to store old ledgers when an org is deleted. It is set to true.
It would be possible to extend this to a settings file later.
--==oo888888888888888888888888888888oo==--
Function: modpol.record(org_name, msg, type)
-- Params: strings msg, org, type
Function: modpol.record(org_id, msg, type)
-- Params: strings msg, type, org_id (number)
-- Outputs:
-- "msg" specifies an event and/or status message.
-- "org" specifies an "org" name.
@ -52,8 +52,8 @@ Function: modpol.record(org_name, msg, type)
--==oo888888888888888888888888888888oo==--
Function: modpol.add_org(org_name, members, parent, properties)
-- Params: string name, table members, string parent, table properties
Function: modpol.add_org(org_id, members, parent, properties)
-- Params: org)id (number), table members, string parent, table properties
-- Parent must be an existing org, defaults to 'instance', properties
-- are arbitrary properties to initialize the org with
@ -75,8 +75,8 @@ Function: modpol.add_org(org_name, members, parent, properties)
--==oo888888888888888888888888888888oo==--
-- Function: modpol.remove_org(org_name, reason)
-- Params: string name, opt string reason
-- Function: modpol.remove_org(org_id, reason)
-- Params: org_id (number), opt string reason
-- Output:
--
-- This function removes an "org". It returns a boolean
@ -114,8 +114,8 @@ Function: modpol.reset_orgs()
--==oo888888888888888888888888888888oo==--
Function: modpol.add_member(org_name, member)
-- Params: org_name (string), member (string)
Function: modpol.add_member(org_id, member)
-- Params: org_id (number), member (string)
-- Output:
-- Adds the specified member to the specified org
-- Returns a boolean success indicator and
@ -124,14 +124,14 @@ Function: modpol.add_member(org_name, member)
--==oo888888888888888888888888888888oo==--
Function: modpol.is_member
-- Params: org (string), member (string)
-- Params: org (number), member (string)
-- Output: boolean, or nil and error message if not applicable. (org nonexistent)
--==oo888888888888888888888888888888oo==--
Function: modpol.remove_member
-- Params: org (string), member (string)
-- Params: org (number), member (string)
-- Output:
-- Removes the specified member from the specified org
-- Returns confirmation or error message