forked from outroll/vesta
-
Notifications
You must be signed in to change notification settings - Fork 47
/
v-change-user-name
executable file
·53 lines (38 loc) · 1.4 KB
/
v-change-user-name
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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