mirror of
https://github.com/myvesta/vesta.git
synced 2024-11-21 04:50:10 -08:00
54 lines
1.4 KiB
Bash
Executable File
54 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: change user full name
|
|
# options: USER FNAME LNAME
|
|
#
|
|
# The function allow to change user's full name.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
user=$1
|
|
fname=$2
|
|
lname=$3
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
source $VESTA/conf/vesta.conf
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Verifications #
|
|
#----------------------------------------------------------#
|
|
|
|
check_args '3' "$#" 'USER FNAME LNAME'
|
|
is_format_valid 'user' 'fname' 'lname'
|
|
is_object_valid 'user' 'USER' "$user"
|
|
is_object_unsuspended 'user' 'USER' "$user"
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Get old values
|
|
old_fname=$(get_user_value '$FNAME')
|
|
old_lname=$(get_user_value '$LNAME')
|
|
|
|
# Changing ns values
|
|
update_user_value "$user" '$FNAME' "$fname"
|
|
update_user_value "$user" '$LNAME' "$lname"
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
# Logging
|
|
log_history "changed user name to $fname $lname"
|
|
log_event "$OK" "$ARGUMENTS"
|
|
|
|
exit
|