v-delete-web-domain-stats-user 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # info: disable webdomain stats authentication support
  3. # options: user domain
  4. #
  5. # The function removes authentication of statistics system. If the script is
  6. # called without naming a certain user, all users will be removed. After
  7. # deleting all of them statistics will be accessible for view without an
  8. # authentication.
  9. #----------------------------------------------------------#
  10. # Variable&Function #
  11. #----------------------------------------------------------#
  12. # Argument defenition
  13. user=$1
  14. domain=$(idn -t --quiet -u "$2" )
  15. # Includes
  16. source $VESTA/conf/vesta.conf
  17. source $VESTA/func/main.sh
  18. source $VESTA/func/domain.sh
  19. #----------------------------------------------------------#
  20. # Verifications #
  21. #----------------------------------------------------------#
  22. check_args '2' "$#" 'user domain'
  23. validate_format 'user' 'domain'
  24. is_system_enabled "$WEB_SYSTEM"
  25. is_object_valid 'user' 'USER' "$user"
  26. is_object_unsuspended 'user' 'USER' "$user"
  27. is_object_valid 'web' 'DOMAIN' "$domain"
  28. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  29. is_object_value_exist 'web' 'DOMAIN' "$domain" '$STATS_USER'
  30. #----------------------------------------------------------#
  31. # Action #
  32. #----------------------------------------------------------#
  33. # Definining statistic dir
  34. rm -f $HOMEDIR/$user/web/$domain/stats/.htpasswd
  35. rm -f $HOMEDIR/$user/web/$domain/stats/.htaccess
  36. #----------------------------------------------------------#
  37. # Vesta #
  38. #----------------------------------------------------------#
  39. # Update config
  40. update_object_value 'web' 'DOMAIN' "$domain" '$STATS_USER' ''
  41. update_object_value 'web' 'DOMAIN' "$domain" '$STATS_CRYPT' ''
  42. # Logging
  43. log_history "disabled web stats password protection for $domain"
  44. log_event "$OK" "$EVENT"
  45. exit