mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-20 20:40:08 -08:00
55 lines
1.5 KiB
Bash
Executable File
55 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: get mail account value
|
|
# options: USER DOMAIN ACCOUNT KEY
|
|
#
|
|
# The function for getting a certain mail account parameter.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
user=$1
|
|
domain=$2
|
|
domain_idn=$2
|
|
account=$3
|
|
key=$(echo "$4"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
|
|
# Additional argument formatting
|
|
format_domain
|
|
format_domain_idn
|
|
# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '3' "$#" 'USER DOMAIN KEY'
|
|
is_format_valid 'user' 'domain'
|
|
is_object_valid 'user' 'USER' "$user"
|
|
is_object_valid 'mail' 'DOMAIN' "$domain"
|
|
is_object_valid "mail/$domain" 'ACCOUNT' "$account"
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Print
|
|
get_object_value "mail/$domain" 'ACCOUNT' "$account" "$key"
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Logging
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|