[Rt-commit] r5881 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Wed Sep 6 22:46:32 EDT 2006


Author: ruz
Date: Wed Sep  6 22:46:31 2006
New Revision: 5881

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/sbin/rt-setup-database.in

Log:
 r3716 at cubic-pc:  cubic | 2006-09-07 06:46:12 +0400
 rt-setup-database::Groups
 * add spport for several member of formats:
 ** 'MyGroup' - name of an user defined group
 ** { Domain => 'xxx', Name => 'adults only' } - hash ref with column => value pairs
 ** [ ... ] - put list into a array to add the group into multiple groups
 


Modified: rt/branches/3.7-EXPERIMENTAL/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/sbin/rt-setup-database.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL/sbin/rt-setup-database.in	Wed Sep  6 22:46:31 2006
@@ -371,9 +371,22 @@
             print "(Error: $msg)" unless $return;
             print $return. ".";
             if ( $member_of ) {
+                $member_of = [ $member_of ] unless ref $member_of eq 'ARRAY';
                 foreach( @$member_of ) {
                     my $parent = RT::Group->new($CurrentUser);
-                    $parent->LoadByCols( %$_ );
+                    if ( ref $_ eq 'HASH' ) {
+                        $parent->LoadByCols( %$_ );
+                    }
+                    elsif ( !ref $_ ) {
+                        $parent->LoadUserDefinedGroup( $_ );
+                    }
+                    else {
+                        print "(Error: wrong format of MemberOf field."
+                            ." Should be name of user defined group or"
+                            ." hash reference with 'column => value' pairs."
+                            ." Use array reference to add to multiple groups)";
+                        next;
+                    }
                     unless ( $parent->Id ) {
                         print "(Error: couldn't load group to add member)";
                         next;


More information about the Rt-commit mailing list