[rt-devel] adding users to groups

Arthur de Jong arthur at West.NL
Tue Mar 27 09:03:37 EST 2001


There is a bug in the code for adding miltiple users to a group. Adding a single 
user works but when you select more users it fails. See the patch for a fix.

-- arthur de jong - arthur at west.nl - west consulting b.v. --
-------------- next part --------------
--- WebRT.1-3-62/html/Admin/Groups/Members.html	Mon Mar 26 11:49:51 2001
+++ WebRT/html/Admin/Groups/Members.html	Tue Mar 27 15:58:37 2001
@@ -47,19 +47,27 @@
 
 $Group->Load($id) || Abort('Could not load group');
 
-
 my $key;
 foreach $key (keys %ARGS) {
-
-if ($key =~ /^DeleteMember-(\d+)$/) {
-    my $id = $1; 
+  if ($key =~ /^DeleteMember-(\d+)$/) {
+    my $id = $1;
     my ($val,$msg) = $Group->DeleteMember($id);
     push (@results, $msg);
-}
-if ($key =~ /^AddMembers$/) {
-    my ($val, $msg) = $Group->AddMember($ARGS{"$key"});
-    push (@results, $msg);
-}
+  }
+  if ($key =~ /^AddMembers$/) {
+    if (ref($ARGS{"$key"}) eq "ARRAY") {
+      # we got an array of users to add
+      my $bla;
+      foreach $bla (@{$ARGS{"$key"}}) {
+        my ($val, $msg) = $Group->AddMember($bla);
+        push (@results, $msg);
+      }
+    } else {
+      # we got a single user to add
+      my ($val, $msg) = $Group->AddMember($ARGS{"$key"});
+      push (@results, $msg);
+    }
+  }
 }
 
 </%INIT>


More information about the Rt-devel mailing list