v_get_user_value 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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/vesta.conf
  14. source $VESTA/func/shared.sh
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking args
  19. check_args '2' "$#" 'user key'
  20. # Checking argument format
  21. validate_format 'user'
  22. # Checking user
  23. is_object_valid 'user' 'USER' "$user"
  24. # Checking domain is not suspened
  25. is_object_suspended 'user' 'USER' "$user"
  26. #----------------------------------------------------------#
  27. # Action #
  28. #----------------------------------------------------------#
  29. # Checking key
  30. value=$(get_user_value "$key")
  31. # Printing value
  32. echo "$value"
  33. #----------------------------------------------------------#
  34. # Vesta #
  35. #----------------------------------------------------------#
  36. # Logging
  37. log_event "$OK" "$EVENT"
  38. exit