removeUser.js 598 B

12345678910111213141516171819202122232425
  1. /*
  2. Remove a User
  3. This example demonstrate the agi script to remove an existsing user
  4. REQUIRE ADMIN PERMISSION
  5. */
  6. if (userIsAdmin() == false){
  7. //Not admin. Reject request
  8. sendResp("Require admin permission to remove user")
  9. }else{
  10. //Try to creat a new user call Dummy
  11. if (userExists("YamiOdymel")){
  12. //User Exists. Continue removing
  13. var succ = removeUser("YamiOdymel");
  14. if (!succ){
  15. sendResp("User Removal Failed");
  16. }else{
  17. sendResp("User Removed");
  18. }
  19. }else{
  20. sendResp("User Not Exists!");
  21. }
  22. }