Skip to content

Commit f59d749

Browse files
committed
added fname,lname and multiple nameserver support
1 parent 5e09a91 commit f59d749

File tree

8 files changed

+61
-30
lines changed

8 files changed

+61
-30
lines changed

bin/v_add_sys_user

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ email="$3"
1212
role="$4"
1313
owner="${5-vesta}"
1414
package="${6-default}"
15-
ns1=$7
16-
ns2=$8
15+
fname=$7
16+
lname=$8
1717

1818
# Importing variables
1919
source $VESTA/conf/vars.conf
@@ -25,11 +25,11 @@ source $V_FUNC/shared_func.sh
2525
#----------------------------------------------------------#
2626

2727
# Checking arg number
28-
check_args '5' "$#" 'user password email role owner [package] [ns1] [ns2]'
28+
check_args '5' "$#" 'user password email role owner [package] [fname] [lname]'
2929

3030
# Checking argument format
31-
format_validation 'user' 'password' 'email' 'role' 'owner' 'package'
32-
format_validation 'ns1' 'ns2'
31+
format_validation 'user' 'password' 'email' 'role' 'owner' 'package'
32+
format_validation 'fname' 'lname'
3333

3434
# Checking user
3535
is_user_free "$user"
@@ -147,17 +147,10 @@ if [ ! -z "$BACKUP_SYSTEM" ] && [ "$BACKUP_SYSTEM" != 'no' ]; then
147147
echo "v_backup_sys_user $user" >> $V_QUEUE/backup.pipe
148148
fi
149149

150-
# Rewriting nameservers
151-
if [ ! -z "$ns1" ]; then
152-
package_data=$(echo "$package_data" | sed -e "s/NS1=.*$/NS1='$ns1'/g")
153-
fi
154-
if [ ! -z "$ns2" ]; then
155-
package_data=$(echo "$package_data" | sed -e "s/NS2=.*$/NS2='$ns2'/g")
156-
fi
157-
158-
159150
# Filling user config
160-
echo "PACKAGE='$package'
151+
echo "FNAME='$fname'
152+
LNAME='$lname'
153+
PACKAGE='$package'
161154
$package_data
162155
SUSPENDED='no'
163156
OWNER='$owner'

bin/v_change_sys_user_ns

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
user="$1"
1010
ns1="$2"
1111
ns2="$3"
12+
ns3="$4"
13+
ns4="$5"
14+
ns5="$6"
15+
ns6="$7"
16+
ns7="$8"
17+
ns8="$9"
1218

1319
# Importing variables
1420
source $VESTA/conf/vars.conf
@@ -20,10 +26,33 @@ source $V_FUNC/shared_func.sh
2026
#----------------------------------------------------------#
2127

2228
# Checking args
23-
check_args '3' "$#" 'user ns1 ns2'
29+
check_args '3' "$#" 'user ns1 ns2 [ns3] [ns4] [ns5] [ns6] [ns7] [ns8]'
2430

2531
# Checking argument format
26-
format_validation 'user' 'ns1' 'ns2'
32+
format_validation 'user' 'ns1' 'ns2'
33+
if [ ! -z "$ns3" ]; then
34+
format_validation 'ns3'
35+
fi
36+
37+
if [ ! -z "$ns4" ]; then
38+
format_validation 'ns4'
39+
fi
40+
41+
if [ ! -z "$ns5" ]; then
42+
format_validation 'ns5'
43+
fi
44+
45+
if [ ! -z "$ns6" ]; then
46+
format_validation 'ns6'
47+
fi
48+
49+
if [ ! -z "$ns7" ]; then
50+
format_validation 'ns7'
51+
fi
52+
53+
if [ ! -z "$ns8" ]; then
54+
format_validation 'ns8'
55+
fi
2756

2857
# Checking user
2958
is_user_valid
@@ -37,20 +66,22 @@ is_user_suspended
3766
#----------------------------------------------------------#
3867

3968
# Get old values
40-
old_ns1=$(get_user_value '$NS1')
41-
old_ns2=$(get_user_value '$NS2')
69+
old_ns=$(get_user_value '$NS')
70+
71+
# Merging values
72+
ns="$ns1,$ns2,$ns3,$ns4,$ns5,$ns6,$ns7,$ns8"
73+
ns=$(echo "$ns"|sed -e "s/,,//g" -e "s/,$//")
4274

4375
# Changing ns values
44-
update_user_value "$user" '$NS1' "$ns1"
45-
update_user_value "$user" '$NS2' "$ns2"
76+
update_user_value "$user" '$NS' "$ns"
4677

4778

4879
#----------------------------------------------------------#
4980
# Vesta #
5081
#----------------------------------------------------------#
5182

5283
# Logging
53-
log_history "$V_EVENT" "$V_SCRIPT $user $old_ns1 $old_ns2"
84+
log_history "$V_EVENT" "$V_SCRIPT $user ${old_ns//,/ }"
5485
log_event 'system' "$V_EVENT"
5586

5687
exit $OK

bin/v_list_sys_user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ conf="$V_USERS/$user/user.conf"
3838
# Defining fileds to select
3939
fields='$USER $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
4040
$MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA
41-
$BANDWIDTH $NS1 $NS2 $SHELL $BACKUPS $WEB_TPL $MAX_CHILDS $SUSPENDED
41+
$BANDWIDTH $NS $SHELL $BACKUPS $WEB_TPL $MAX_CHILDS $SUSPENDED
4242
$OWNER $ROLE $IP_OWNED $U_CHILDS $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS
4343
$U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES $U_MAIL_DOMAINS $CONTACT $DATE'
4444

bin/v_list_sys_users

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ format_validation 'limit' 'offset'
2727
#----------------------------------------------------------#
2828

2929
# Defining fileds to select
30-
fields='$USER $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
30+
fields='$USER $NAME $PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
3131
$MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA
32-
$BANDWIDTH $NS1 $NS2 $SHELL $BACKUPS $WEB_TPL $MAX_CHILDS $SUSPENDED
32+
$BANDWIDTH $NS $SHELL $BACKUPS $WEB_TPL $MAX_CHILDS $SUSPENDED
3333
$OWNER $ROLE $IP_OWNED $U_CHILDS $U_DISK $U_BANDWIDTH $U_WEB_DOMAINS
3434
$U_WEB_SSL $U_DNS_DOMAINS $U_DATABASES $U_MAIL_DOMAINS $CONTACT $DATE'
3535

data/dbservers/.gitignore

Whitespace-only changes.

data/packages/default.pkg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ MAIL_FORWARDERS='30'
99
DNS_DOMAINS='10'
1010
DISK_QUOTA='10000'
1111
BANDWIDTH='10000'
12-
NS1='ns1.localhost'
13-
NS2='ns2.localhost'
12+
NS='ns1.localhost,ns2.localhost'
1413
SHELL='nologin'
1514
BACKUPS='3'
1615
MAX_CHILDS='300'

data/packages/palegreen.pkg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ MAIL_FORWARDERS='50'
99
DNS_DOMAINS='30'
1010
DISK_QUOTA='50000'
1111
BANDWIDTH='50000'
12-
NS1='ns1.localhost'
13-
NS2='ns2.localhost'
12+
NS='ns1.localhost,ns2.localhost'
1413
SHELL='nologin'
1514
BACKUPS='5'
1615
MAX_CHILDS='300'

func/shared_func.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ log_history() {
2525

2626
# Checking logging system
2727
log_history=$(grep 'LOG_HISTORY=' $V_CONF/vesta.conf | cut -f 2 -d \' )
28-
if [ "$log_history" = 'on' ]; then
28+
if [ "$log_history" = 'yes' ]; then
2929
echo "$event [$undo]" >> $V_USERS/$user/history.log
3030
fi
3131
}
@@ -302,8 +302,16 @@ format_validation() {
302302
domain) format_dom "$v" ;;
303303
database) format_db "$v" ;;
304304
db_user) format_dbu "$v" ;;
305+
fname) format_usr "$v" ;;
306+
ns) format_dom "$v" ;;
305307
ns1) format_dom "$v" ;;
306308
ns2) format_dom "$v" ;;
309+
ns3) format_dom "$v" ;;
310+
ns4) format_dom "$v" ;;
311+
ns5) format_dom "$v" ;;
312+
ns6) format_dom "$v" ;;
313+
ns7) format_dom "$v" ;;
314+
ns8) format_dom "$v" ;;
307315
email) format_eml "$v" ;;
308316
extentions) format_ext "$v" ;;
309317
host) format_usr "$v" ;;
@@ -316,6 +324,7 @@ format_validation() {
316324
max_usr) format_int "$v" ;;
317325
max_db) format_int "$v" ;;
318326
limit) format_int "$v" ;;
327+
lname) format_usr "$v" ;;
319328
offset) format_int "$v" ;;
320329
owner) format_usr "$v" ;;
321330
package) format_usr "$v" ;;

0 commit comments

Comments
 (0)