Skip to content

Commit 72781b5

Browse files
committed
removed child user support
1 parent e48992c commit 72781b5

18 files changed

+35
-421
lines changed

bin/v_add_sys_ip

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
ip="$1"
1010
mask="$2"
1111
interface="${3-eth0}"
12-
owner="${4-vesta}"
12+
user="${4-vesta}"
1313
ip_status="${5-shared}"
1414
ip_name="$6"
1515

@@ -24,19 +24,16 @@ source $V_FUNC/domain_func.sh # for namehosting
2424
#----------------------------------------------------------#
2525

2626
# Checking arg number
27-
check_args '2' "$#" 'ip mask [interface] [owner] [ip_status] [ip_name]'
27+
check_args '2' "$#" 'ip mask [interface] [user] [ip_status] [ip_name]'
2828

2929
# Checking argument format
30-
format_validation 'ip' 'mask' 'interface'
30+
format_validation 'ip' 'mask' 'interface' 'user'
3131

3232
# Checking system ip
3333
is_sys_ip_free
3434

35-
# Checking owner
36-
if [ ! -z "$owner" ]; then
37-
format_validation 'user'
38-
is_user_valid "$owner"
39-
fi
35+
# Checking user
36+
is_user_valid "$user"
4037

4138
# Checking ip_status
4239
if [ ! -z "$ip_status" ]; then
@@ -84,10 +81,7 @@ namehost_ip_support
8481
#----------------------------------------------------------#
8582

8683
# Updating user conf
87-
if [ ! -z "$owner" ]; then
88-
user="$owner"
89-
increase_user_value "$user" '$IP_OWNED'
90-
fi
84+
increase_user_value "$user" '$IP_OWNED'
9185

9286
# Adding task to the vesta pipe
9387
if [ "$web_restart" = 'yes' ]; then

bin/v_add_sys_user

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
user="$1"
1010
password="$2"
1111
email="$3"
12-
role="$4"
13-
owner="${5-vesta}"
14-
package="${6-default}"
15-
fname=$7
16-
lname=$8
12+
package="${4-default}"
13+
fname=$5
14+
lname=$6
1715

1816
# Importing variables
1917
source $VESTA/conf/vars.conf
@@ -25,29 +23,16 @@ source $V_FUNC/shared_func.sh
2523
#----------------------------------------------------------#
2624

2725
# Checking arg number
28-
check_args '5' "$#" 'user password email role owner [package] [fname] [lname]'
26+
check_args '3' "$#" 'user password email [package] [fname] [lname]'
2927

3028
# Checking argument format
31-
format_validation 'user' 'password' 'email' 'role' 'owner' 'package'
32-
format_validation 'fname' 'lname'
29+
format_validation 'user' 'password' 'email' 'package' 'fname' 'lname'
3330

3431
# Checking user
3532
is_user_free "$user"
3633

37-
# Checking 'vesta' user creation
38-
if [ "$user" != 'vesta' ]; then
39-
# Checking owner
40-
is_user_valid "$owner"
41-
42-
# Checking owner role
43-
is_user_privileged "$owner"
44-
45-
# Checking owner permission
46-
is_user_privileged "$owner" "$role"
47-
48-
# Checking package
49-
is_package_valid "$package"
50-
fi
34+
# Checking package
35+
is_package_valid "$package"
5136

5237

5338
#----------------------------------------------------------#
@@ -149,12 +134,9 @@ LNAME='$lname'
149134
PACKAGE='$package'
150135
$package_data
151136
SUSPENDED='no'
152-
OWNER='$owner'
153-
ROLE='$role'
154137
CONTACT='$email'
155138
REPORTS='yes'
156139
IP_OWNED='0'
157-
U_CHILDS='0'
158140
U_DIR_DISK='0'
159141
U_DISK='0'
160142
U_BANDWIDTH='0'
@@ -165,15 +147,9 @@ U_DATABASES='0'
165147
U_MAIL_DOMAINS='0'
166148
DATE='$V_DATE'" > $V_USERS/$user/user.conf
167149

168-
# Filling owner config
169-
if [ "$user" != 'vesta' ]; then
170-
echo "USER='$user'" >> $V_USERS/$owner/child.conf
171-
increase_user_value "$owner" 'U_CHILDS'
172-
fi
173-
174150
# Hiding password
175151
dt="$(date +%m-%d-%y" "%H:%m:%S)"
176-
V_EVENT="$dt $V_SCRIPT $user ***** $email $role $owner $package $fname $lname"
152+
V_EVENT="$dt $V_SCRIPT $user ***** $email $package $fname $lname"
177153

178154
# Logging
179155
log_event 'system' "$V_EVENT"

bin/v_add_sys_user_ip

Lines changed: 0 additions & 67 deletions
This file was deleted.

bin/v_backup_sys_user

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,6 @@ if [ -e "$V_USERS/$user/billing.log" ]; then
368368
cp -r $V_USERS/$user/billing.log $tmpdir/vesta/
369369
fi
370370

371-
if [ -e "$V_USERS/$user/child.conf" ]; then
372-
if [ -z "$output" ]; then
373-
echo -e "\t$(date +%H:%m:%S) child.conf"
374-
fi
375-
376-
cp -r $V_USERS/$user/child.conf $tmpdir/vesta/
377-
fi
378-
379371
if [ -e "$V_USERS/$user/history.log" ]; then
380372
if [ -z "$output" ]; then
381373
echo -e "\t$(date +%H:%m:%S) history.log"

bin/v_change_sys_ip_owner

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,14 @@ is_ip_key_empty '$U_SYS_USERS'
4545
# Action #
4646
#----------------------------------------------------------#
4747

48-
# Get ip and user owner
48+
# Changing ip owner
4949
ip_owner=$(get_sys_ip_value '$OWNER')
50-
user_owner=$(get_user_value '$OWNER')
51-
owner_role=$(get_user_value '$ROLE')
52-
53-
# Checking permissions
54-
if [ "$owner_role" != 'admin' ] || [ "$ip_owner" != "$user_owner" ]; then
55-
echo "Error: ip owner is not admin"
56-
log_event 'debug' "$E_PERMS_REQUEIURED $V_EVENT"
57-
exit $E_PERMS_REQUEIURED
50+
if [ "$ip_owner" != "$user" ]; then
51+
update_sys_ip_value '$OWNER' "$user"
52+
decrease_user_value "$ip_owner" '$IP_OWNED'
53+
increase_user_value "$user" '$IP_OWNED'
5854
fi
5955

60-
# Changing ip owner
61-
update_sys_ip_value '$OWNER' "$user"
62-
6356

6457
#----------------------------------------------------------#
6558
# Vesta #

bin/v_del_sys_user

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ is_user_valid
3333
# Checking user is active
3434
is_user_suspended
3535

36-
# Checking user childs
37-
is_user_parent
38-
36+
# Checking user vesta
37+
if [ "$user" = 'vesta' ]; then
38+
exit
39+
fi
3940

4041
#----------------------------------------------------------#
4142
# Action #
@@ -111,18 +112,6 @@ if [ ! -z "$statp" ]; then
111112
done
112113
fi
113114

114-
# Deleteing user from parent
115-
owner=$(get_user_value '$OWNER')
116-
if [ -e "$V_USERS/$owner/child.conf" ]; then
117-
childc=$(grep -n "USER='$user'" $V_USERS/$owner/child.conf |\
118-
cut -d : -f 1 | sort -n -r)
119-
fi
120-
if [ ! -z "$childc" ]; then
121-
for str in $childc; do
122-
sed -i "$str d" $V_USERS/$owner/child.conf
123-
done
124-
fi
125-
126115
# Removing system user
127116
userdel -f $user
128117
rm -rf $V_HOME/$user

bin/v_del_sys_user_ip

Lines changed: 0 additions & 65 deletions
This file was deleted.

bin/v_del_sys_user_ips

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)