2 # Update, add or delete a resource control
4 require './zones-lib.pl';
7 $zinfo = &get_zone($in{'zone'});
8 $zinfo || &error($text{'edit_egone'});
10 # Find the rctl object
11 ($rctl) = grep { $_->{'name'} eq $in{'old'} } @{$zinfo->{'rctl'}};
12 $rctl || &error($text{'rctl_egone'});
15 $rctl = { 'keytype' => 'rctl' };
19 # Just remove this resource control
20 &delete_zone_object($zinfo, $rctl);
24 $form = &get_rctl_form(\%in, $zinfo, $rctl);
25 $table = $form->get_section(1);
26 $form->validate_redirect("edit_rctl.cgi");
27 $rctl->{'name'} = $form->get_value("name");
29 for($i=0; $i<$table->get_rowcount(); $i++) {
30 local ($priv, $limit, $action) = $table->get_values($i);
33 "(priv=$priv,limit=$limit,action=$action)");
36 @values || &error($text{'rctl_evalues'});
37 $rctl->{'value'} = join("\0", @values);
38 &find_clash($zinfo, $rctl) &&
39 $form->validate_redirect("edit_fs.cgi",
40 [ [ "name", $text{'rctl_eclash'} ] ]);
44 &create_zone_object($zinfo, $rctl);
47 &modify_zone_object($zinfo, $rctl);
51 &webmin_log($in{'new'} ? "create" : $in{'delete'} ? "delete" : "modify",
52 "rctl", $in{'old'} || $rctl->{'name'}, $rctl);
53 &redirect("edit_zone.cgi?zone=$in{'zone'}");