remove_org.lua 834 B

1234567891011121314151617181920212223242526272829303132
  1. --- A simple module that removes an org.
  2. -- @module remove_org
  3. remove_org = {
  4. name = "Remove this org",
  5. slug = "remove_org",
  6. desc = "Eliminates the org and all child orgs."
  7. }
  8. remove_org.config = {}
  9. remove_org.data = {}
  10. --- Removes org
  11. -- @function remove_org:initiate
  12. -- @param result Callback if this module is embedded in other modules
  13. function remove_org:initiate(result)
  14. if self.org == modpol.instance then
  15. modpol.interactions.message(
  16. self.initiator,
  17. "Cannot remove the root org")
  18. else
  19. modpol.interactions.message_org(
  20. self.initiator,self.org.id,
  21. "Removing org: "..self.org.name)
  22. self.org:delete()
  23. modpol.interactions.dashboard(self.initiator)
  24. -- call result function
  25. end
  26. if result then result() end
  27. end
  28. modpol.modules.remove_org = remove_org