Skip to content

Commit 4e01254

Browse files
committed
Work on allowing domain owners to migrate domains
1 parent 9630041 commit 4e01254

11 files changed

+26
-8
lines changed

Diff for: acl_security.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ sub acl_security_form
2121
}
2222
print "</select></td> </tr>\n";
2323

24-
foreach $q ('create', 'import', 'edit', 'local', 'stop') {
24+
foreach $q ('create', 'import', 'migrate', 'edit', 'local', 'stop') {
2525
print "<tr> <td><b>",$text{'acl_'.$q},"</b></td> <td>\n";
2626
printf "<input type=radio name=%s value=1 %s> %s\n",
2727
$q, $_[0]->{$q} == 1 ? "checked" : "", $text{'yes'};

Diff for: defaultacl

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
edit=1
22
create=1
33
import=1
4+
migrate=1
45
domains=*
56
stop=1
67
local=1

Diff for: edit_limits.cgi

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ print &ui_table_row(&hlink($text{'limits_norename'}, "limits_norename"),
7171
&ui_radio("norename", $d->{'norename'} ? 1 : 0,
7272
[ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]));
7373

74+
# Can migrate domains?
75+
print &ui_table_row(&hlink($text{'limits_migrate'}, "limits_migrate"),
76+
&ui_radio("migrate", $d->{'migrate'} ? 1 : 0,
77+
[ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
78+
7479
# Force sub-domain under master domain
7580
print &ui_table_row(&hlink($text{'limits_forceunder'}, "limits_forceunder"),
7681
&ui_radio("forceunder", $d->{'forceunder'} ? 1 : 0,

Diff for: feature-webmin.pl

+1
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ sub set_user_modules
506506
'local' => 0,
507507
'nodbname' => $_[0]->{'nodbname'},
508508
'norename' => $_[0]->{'norename'},
509+
'migrate' => $_[0]->{'migrate'},
509510
'forceunder' => $_[0]->{'forceunder'},
510511
'safeunder' => $_[0]->{'safeunder'},
511512
'ipfollow' => $_[0]->{'ipfollow'},

Diff for: lang/en

+2
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,7 @@ acl_all=All domains
13891389
acl_sel=Selected below ..
13901390
acl_create=Can create new domains?
13911391
acl_import=Can import existing domains?
1392+
acl_migrate=Can migrate backups?
13921393
acl_edit=Can edit existing domains?
13931394
acl_local=Can edit local users?
13941395
acl_stop=Can start and stop services?
@@ -2662,6 +2663,7 @@ limits_ealiasdomslimit=Missing or invalid maximum number of alias servers
26622663
limits_erealdomslimit=Missing or invalid maximum number of non-alias servers
26632664
limits_nodbname=Can choose database names?
26642665
limits_norename=Can rename domains?
2666+
limits_migrate=Can migrate backups?
26652667
limits_forceunder=Allow sub-servers not under this domain?
26662668
limits_safeunder=Allow sub-servers under other users' domains?
26672669
limits_ipfollow=Sub-servers inherit IP address from parent?

Diff for: list-domains.pl

+2
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ package virtual_server;
663663
($d->{'nodbname'} ? "No" : "Yes"),"\n";
664664
print " Can rename servers: ",
665665
($d->{'norename'} ? "No" : "Yes"),"\n";
666+
print " Can migrate backups: ",
667+
($d->{'migrate'} ? "Yes" : "No"),"\n";
666668
print " Sub-servers must be under main domain: ",
667669
($d->{'forceunder'} ? "Yes" : "No"),"\n";
668670
print " Sub-servers cannot be under other domains: ",

Diff for: migrate.cgi

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require './virtual-server-lib.pl';
88
&require_migration();
99

1010
# Parse source file input
11-
$src = &parse_backup_destination("src", \%in, 0, undef, undef);
11+
$src = &parse_backup_destination("src", \%in, !&master_admin(), undef, undef);
1212
($mode) = &parse_backup_url($src);
1313
if ($mode == 0) {
1414
-r $src || &error($text{'migrate_efile'});

Diff for: migrate_form.cgi

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ print &ui_table_start($text{'migrate_header'}, "width=100%", 2, [ "width=30%"]);
1414

1515
# Source file
1616
print &ui_table_row($text{'migrate_file'},
17-
&show_backup_destination("src", undef, 0, undef, 1, 0));
18-
# &ui_radio("mode", 0,
19-
# [ [ 0, &text('migrate_file0', &ui_upload("upload"))."<br>" ],
20-
# [ 1, &text('migrate_file1', &ui_textbox("file", undef, 50)).
21-
# &file_chooser_button("file") ] ]));
17+
&show_backup_destination("src", undef, !&master_admin(), undef, 1, 0));
2218

2319
# Source type (plesk, cpanel, etc..)
2420
print &ui_table_row($text{'migrate_type'},

Diff for: modify-limits.pl

+9
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ package virtual_server;
159159
elsif ($a eq "--cannot-rename") {
160160
$cannotrename = 1;
161161
}
162+
elsif ($a eq "--can-migrate") {
163+
$canmigrate = 1;
164+
}
165+
elsif ($a eq "--cannot-migrate") {
166+
$cannotmigrate = 1;
167+
}
162168
elsif ($a eq "--force-under") {
163169
$forceunder = 1;
164170
}
@@ -272,6 +278,8 @@ package virtual_server;
272278
$cannotdbname ? 1 : $dom->{'nodbname'};
273279
$dom->{'norename'} = $canrename ? 0 :
274280
$cannotrename ? 1 : $dom->{'norename'};
281+
$dom->{'migrate'} = $canmigrate ? 1 :
282+
$cannotmigrate ? 0 : $dom->{'migrate'};
275283
$dom->{'forceunder'} = $forceunder ? 1 :
276284
$noforceunder ? 0 : $dom->{'forceunder'};
277285
$dom->{'safeunder'} = $safeunder ? 1 :
@@ -329,6 +337,7 @@ sub usage
329337
print " [--max-aliases max|UNLIMITED]\n";
330338
print " [--can-dbname] | [--cannot-dbname]\n";
331339
print " [--can-rename] | [--cannot-rename]\n";
340+
print " [--can-migrate] | [--cannot-migrate]\n";
332341
print " [--force-under] | [--noforce-under]\n";
333342
print " [--safe-under] | [--nosafe-under]\n";
334343
print " [--ipfollow] | [--noipfollow]\n";

Diff for: plans-lib.pl

+2-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ sub convert_plans
208208
$plan->{'capabilities'} = $tmpl->{'capabilities'} eq 'none' ? '' :
209209
$tmpl->{'capabilities'};
210210
foreach my $n ('nodbname', 'norename', 'forceunder', 'safeunder',
211-
'ipfollow') {
211+
'ipfollow', 'migrate') {
212212
$plan->{$n} = $tmpl->{$n};
213213
}
214214
&save_plan($plan);
@@ -254,6 +254,7 @@ sub set_limits_from_plan
254254
$d->{'forceunder'} = $plan->{'forceunder'};
255255
$d->{'safeunder'} = $plan->{'safeunder'};
256256
$d->{'ipfollow'} = $plan->{'ipfollow'};
257+
$d->{'migrate'} = $plan->{'migrate'};
257258
}
258259

259260
# set_reseller_limits_from_plan(&reseller, &plan)

Diff for: save_limits.cgi

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ $d->{'realdomslimit'} = $in{'realdomslimit_def'} == 1 ? undef
3131
: $in{'realdomslimit'};
3232
$d->{'nodbname'} = $in{'nodbname'};
3333
$d->{'norename'} = $in{'norename'};
34+
$d->{'migrate'} = $in{'migrate'};
3435
$d->{'forceunder'} = $in{'forceunder'};
3536
$d->{'safeunder'} = $in{'safeunder'};
3637
$d->{'ipfollow'} = $in{'ipfollow'};

0 commit comments

Comments
 (0)