mirror of
https://github.com/serghey-rodin/vesta.git
synced 2024-12-03 19:00:24 -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
|