v-get-mail-account-value 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # info: get mail account value
  3. # options: USER DOMAIN ACCOUNT KEY
  4. #
  5. # The function for getting a certain mail account parameter.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument definition
  10. user=$1
  11. domain=$2
  12. account=$3
  13. key=$(echo "$4"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
  14. # Includes
  15. source $VESTA/func/main.sh
  16. # Additional argument formatting
  17. format_domain
  18. format_domain_idn
  19. #----------------------------------------------------------#
  20. # Verifications #
  21. #----------------------------------------------------------#
  22. check_args '3' "$#" 'USER DOMAIN KEY'
  23. is_format_valid 'user' 'domain'
  24. is_object_valid 'user' 'USER' "$user"
  25. is_object_valid 'mail' 'DOMAIN' "$domain"
  26. is_object_valid "mail/$domain" 'ACCOUNT' "$account"
  27. #----------------------------------------------------------#
  28. # Action #
  29. #----------------------------------------------------------#
  30. # Print
  31. get_object_value "mail/$domain" 'ACCOUNT' "$account" "$key"
  32. #----------------------------------------------------------#
  33. # Vesta #
  34. #----------------------------------------------------------#
  35. # Logging
  36. log_event "$OK" "$ARGUMENTS"
  37. exit