v_get_user_value 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # info: get user value
  3. # options: user key
  4. #
  5. # The function for obtaining certain user's parameters.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. key=$(echo "$2"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
  12. # Importing variables
  13. source $VESTA/conf/vars.conf
  14. source $V_CONF/vesta.conf
  15. source $V_FUNC/shared.func
  16. #----------------------------------------------------------#
  17. # Verifications #
  18. #----------------------------------------------------------#
  19. # Checking args
  20. check_args '2' "$#" 'user key'
  21. # Checking argument format
  22. format_validation 'user'
  23. # Checking user
  24. is_user_valid
  25. # Checking domain is not suspened
  26. is_user_suspended
  27. #----------------------------------------------------------#
  28. # Action #
  29. #----------------------------------------------------------#
  30. # Checking key
  31. value=$(get_user_value "$key")
  32. # Printing value
  33. echo "$value"
  34. #----------------------------------------------------------#
  35. # Vesta #
  36. #----------------------------------------------------------#
  37. # Logging
  38. log_event 'system' "$V_EVENT"
  39. exit