diff options
Diffstat (limited to 'utils/rhrd-group')
-rwxr-xr-x | utils/rhrd-group | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/utils/rhrd-group b/utils/rhrd-group index 7aa5f6b..a66597e 100755 --- a/utils/rhrd-group +++ b/utils/rhrd-group @@ -125,6 +125,35 @@ sub add_member return 1; } print int($cnt) . " rows affected\n"; + + my $group_type = ""; + $group_type = "shows" if($groupname eq $ctx->{'config'}{'specialgroups'}{'allshows'}); + $group_type = "jingles" if($groupname eq $ctx->{'config'}{'specialgroups'}{'alljingles'}); + $group_type = "pools" if($groupname eq $ctx->{'config'}{'specialgroups'}{'allpools'}); + + unless($group_type eq "") { + local $| = 1; + + my @groups = RHRD::rddb::list_groups($ctx, $group_type); + if(!defined $groups[0] && defined $groups[1]) { + print STDERR "$groups[1]: $groups[2]"; + return 1; + } + print "also adding to " . scalar(@groups) . " other groups "; + for my $group (@groups) { + my ($cnt, undef, $errorstring) = RHRD::rddb::add_group_member($ctx, $group, $username); + unless(defined $cnt) { + print STDERR "$errorstring\n"; + return 1; + } + if($cnt > 0) { + print "+"; + } else { + print "."; + } + } + print " done.\n"; + } return 0; } @@ -138,6 +167,35 @@ sub remove_member return 1; } print int($cnt) . " rows affected\n"; + + my $group_type = ""; + $group_type = "shows" if($groupname eq $ctx->{'config'}{'specialgroups'}{'allshows'}); + $group_type = "jingles" if($groupname eq $ctx->{'config'}{'specialgroups'}{'alljingles'}); + $group_type = "pools" if($groupname eq $ctx->{'config'}{'specialgroups'}{'allpools'}); + + unless($group_type eq "") { + local $| = 1; + + my @groups = RHRD::rddb::list_groups($ctx, $group_type); + if(!defined $groups[0] && defined $groups[1]) { + print STDERR "$groups[1]: $groups[2]"; + return 1; + } + print "also removing from " . scalar(@groups) . " other groups "; + for my $group (@groups) { + my ($cnt, undef, $errorstring) = RHRD::rddb::remove_group_member($ctx, $group, $username); + unless(defined $cnt) { + print STDERR "$errorstring\n"; + return 1; + } + if($cnt > 0) { + print "-"; + } else { + print "."; + } + } + print " done.\n"; + } return 0; } |