nested_functions.lua 818 B

12345678910111213141516171819202122232425262728293031
  1. dofile("../modpol.lua")
  2. print('\nRemoving existing orgs')
  3. modpol.orgs.reset()
  4. print('\nCreating an org called "test_org"')
  5. test_org = modpol.instance:add_org('test_org', 'luke')
  6. print('\nAdding user "nathan" to test_org')
  7. test_org:add_member('nathan')
  8. print("\nOkay, let's start with requests. Setting up an org...")
  9. modpol.instance:add_org('test_org', 'luke')
  10. test_org:add_member('nathan')
  11. print('\nMaking consent the add_member policy')
  12. test_org:set_policy("add_member", "consent", false);
  13. print('\nMaking a request to add Josh')
  14. add_josh = {
  15. user = "josh",
  16. type = "add_member",
  17. params = {"josh"}
  18. }
  19. request_id = test_org:make_request(add_josh)
  20. print('\nHave the two members vote on it')
  21. modpol.interactions.org_dashboard("nathan","test_org")
  22. modpol.interactions.org_dashboard("luke","test_org")