#!/bin/bash
# info: get user value
# options: user key
#
# The function for obtaining certain user's parameters.


#----------------------------------------------------------#
#                    Variable&Function                     #
#----------------------------------------------------------#

# Argument defenition
user=$1
key=$(echo "$2"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")

# Includes
source $VESTA/conf/vesta.conf
source $VESTA/func/main.sh


#----------------------------------------------------------#
#                    Verifications                         #
#----------------------------------------------------------#

check_args '2' "$#" 'user key'
validate_format 'user'
is_object_valid 'user' 'USER' "$user"


#----------------------------------------------------------#
#                       Action                             #
#----------------------------------------------------------#

# Checking key
value=$(get_user_value "$key")

# Printing value
echo "$value"


#----------------------------------------------------------#
#                       Vesta                              #
#----------------------------------------------------------#

# Logging
log_event "$OK" "$EVENT"

exit
