summaryrefslogtreecommitdiff
path: root/utils/rhrd-group
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-10-08 22:42:20 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-10-08 22:42:23 (GMT)
commite10c9d729f9c7c9bf342e0053dc53988d4e26ff2 (patch)
tree1bd30c7d4e0fa3cc5d73aba201d580dd4d8f67b0 /utils/rhrd-group
parentbf2c23eda20c6e494e1fb3e8f85b775cfaea3c37 (diff)
most important group sanity cheks are done
Diffstat (limited to 'utils/rhrd-group')
-rwxr-xr-xutils/rhrd-group21
1 files changed, 17 insertions, 4 deletions
diff --git a/utils/rhrd-group b/utils/rhrd-group
index 0f82c33..4f59c07 100755
--- a/utils/rhrd-group
+++ b/utils/rhrd-group
@@ -36,8 +36,8 @@ sub print_usage
" rd-group (check|remove|get-members|get-carts|get-reports) <groupname>\n" .
" rd-group add <groupname> [ <description> ]\n" .
" rd-group (add-member|remove-member|is-member) <groupname> <user>\n" .
- " rd-group set-carts <groupname> [ <low> [ <high> [ <type> [ <enforce range> ]]]\n" .
- " rd-group set-reports <groupname> [ <nownext> [ <traffic> [ <music> ]]]\n";
+ " rd-group set-carts <groupname> <low> <high> [ <type> [ <enforce range> ]]\n" .
+ " rd-group set-reports <groupname> <nownext> <traffic> <music>\n";
}
sub list
@@ -163,6 +163,12 @@ sub set_carts
{
my ($ctx, $groupname, $low_cart, $high_cart, $cart_type, $enforce_cart_range) = @_;
+ $low_cart = RHRD::rddb::RD_INVALID_CART unless($low_cart >= RHRD::rddb::RD_MIN_CART && $low_cart <= RHRD::rddb::RD_MAX_CART);
+ $high_cart = RHRD::rddb::RD_INVALID_CART unless($high_cart >= RHRD::rddb::RD_MIN_CART && $high_cart <= RHRD::rddb::RD_MAX_CART);
+ $cart_type = 1 unless($cart_type == 1 || $cart_type == 2);
+ $enforce_cart_range = 'Y' if ($enforce_cart_range eq 'Y' || $enforce_cart_range eq 'y' || $enforce_cart_range eq '1');
+ $enforce_cart_range = 'N' unless ($enforce_cart_range eq 'Y');
+
my ($cnt, undef, $errorstring) = RHRD::rddb::set_group_cart_range($ctx, $groupname, $low_cart, $high_cart, $cart_type, $enforce_cart_range);
unless(defined $cnt) {
print STDERR "$errorstring\n";
@@ -189,6 +195,13 @@ sub set_reports
{
my ($ctx, $groupname, $now_next, $traffic, $music) = @_;
+ $now_next = 'Y' if ($now_next eq 'Y' || $now_next eq 'y' || $now_next eq '1');
+ $now_next = 'N' unless ($now_next eq 'Y');
+ $traffic = 'Y' if ($traffic eq 'Y' || $traffic eq 'y' || $traffic eq '1');
+ $traffic = 'N' unless ($traffic eq 'Y');
+ $music = 'Y' if ($music eq 'Y' || $music eq 'y' || $music eq '1');
+ $music = 'N' unless ($music eq 'Y');
+
my ($cnt, undef, $errorstring) = RHRD::rddb::set_group_reports($ctx, $groupname, $now_next, $traffic, $music);
unless(defined $cnt) {
print STDERR "$errorstring\n";
@@ -284,7 +297,7 @@ if(defined $ctx) {
}
}
elsif($cmd eq "set-carts") {
- if($num_args < 2 || $num_args > 6) {
+ if($num_args < 4 || $num_args > 6) {
print_usage();
$ret = 1;
} else {
@@ -300,7 +313,7 @@ if(defined $ctx) {
}
}
elsif($cmd eq "set-reports") {
- if($num_args < 2 || $num_args > 5) {
+ if($num_args != 5) {
print_usage();
$ret = 1;
} else {