This commit is contained in:
Alexey Berezhok
2024-03-19 22:05:27 +03:00
commit 346a50856b
1572 changed files with 182163 additions and 0 deletions

47
bin/v-get-user-value Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
# info: get user value
# options: USER KEY
#
# example: v-get-user-value admin FNAME
#
# This function for obtaining certain user's parameters.
#----------------------------------------------------------#
# Variables & Functions #
#----------------------------------------------------------#
# Argument definition
user=$1
key=$(echo "$2" | tr '[:lower:]' '[:upper:]')
# Includes
# shellcheck source=/etc/hestiacp/hestia.conf
source /etc/hestiacp/hestia.conf
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# load config file
source_conf "$HESTIA/conf/hestia.conf"
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'USER KEY'
is_format_valid 'user' 'key'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Checking key
value=$(get_user_value "$key")
# Printing value
echo "$value"
#----------------------------------------------------------#
# Hestia #
#----------------------------------------------------------#
exit