summaryrefslogtreecommitdiff
path: root/utils/rhrd-group
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-29 15:27:05 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-29 15:27:05 (GMT)
commit63439f9f734710f9f96523a9cbb8bb9728b4647d (patch)
treeafd48cd678b826e581d3501753fdf769fdea8cd0 /utils/rhrd-group
parentb865b96be37a6a48a4618b5bc24dbea3c6bfe311 (diff)
honoring special groups on add/remove group members
Diffstat (limited to 'utils/rhrd-group')
-rwxr-xr-xutils/rhrd-group58
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;
}