Module modpol.orgs.base

Basic function for orgs

Functions

modpol.orgs.get_org (arg) Return org when given its id or name
modpol.orgs.list_all () Return a table list of all org names
modpol.orgs.user_orgs (user) Return the orgs of a user
modpol.orgs.reset () Deletes all orgs except for the
modpol.orgs.init_instance () Initializes the instance (root org) can only be run once, as only one instance can exist
modpol.orgs:record () Records a log message to the modpol ledger
modpol.orgs:add_org (name, user) Adds a new sub org to the org it is called on.
modpol.orgs:delete () Recursively deletes an org and its suborgs Leaves entry in modpol.orgs.array as a string "removed".
modpol.orgs:get_member_index (member) Internal function to get the index of a member name
modpol.orgs:add_member (user) Adds a user to an org
modpol.orgs:remove_member (user) Removes a user from an org
modpol.orgs:has_member (user) Boolean check whether user is an org
modpol.orgs:list_members ()
modpol.orgs:get_member_count () Because member list uses lazy deletion, using #org.members will not show an accurate number
modpol.orgs:set_policy (policy_type, process_type, must_be_member) Adds a new policy to the policy table.


Functions

modpol.orgs.get_org (arg)
Return org when given its id or name

Parameters:

  • arg string for name of org or id of org

Returns:

    org specified by id or name
modpol.orgs.list_all ()
Return a table list of all org names

Returns:

    a table list of all org names
modpol.orgs.user_orgs (user)
Return the orgs of a user

Parameters:

  • user string of user name

Returns:

    table of strings of org names
modpol.orgs.reset ()
Deletes all orgs except for the
modpol.orgs.init_instance ()
Initializes the instance (root org) can only be run once, as only one instance can exist
modpol.orgs:record ()
Records a log message to the modpol ledger
modpol.orgs:add_org (name, user)
Adds a new sub org to the org it is called on. Ex: instance:add_org('town hall')

Parameters:

  • name (string) name of new org
  • user (string)

Returns:

    child org created
modpol.orgs:delete ()
Recursively deletes an org and its suborgs Leaves entry in modpol.orgs.array as a string "removed". Note: "reason" param was removed, can be added back
modpol.orgs:get_member_index (member)
Internal function to get the index of a member name

Parameters:

  • member

Returns:

    index of given member
modpol.orgs:add_member (user)
Adds a user to an org

Parameters:

  • user
modpol.orgs:remove_member (user)
Removes a user from an org

Parameters:

  • user
modpol.orgs:has_member (user)
Boolean check whether user is an org

Parameters:

  • user

Returns:

    true if user is in org, false if not
modpol.orgs:list_members ()

Returns:

    a table of the names (string) of members
modpol.orgs:get_member_count ()
Because member list uses lazy deletion, using #org.members will not show an accurate number

Returns:

    numbers of members
modpol.orgs:set_policy (policy_type, process_type, must_be_member)
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

Parameters:

  • policy_type
  • process_type
  • must_be_member Boolean
generated by LDoc 1.4.6 Last updated 2022-01-20 10:54:01