[Rt-commit] rt branch, 4.0/initialdata-membership, repushed
Alex Vandiver
alexmv at bestpractical.com
Fri Oct 11 22:29:54 EDT 2013
The branch 4.0/initialdata-membership was deleted and repushed:
was 5bc2656271b12a9b1215e9c6800505126b356557
now 58b176dbe790ee2026fbac2d86bb54cbbe3da324
1: 5bc2656 ! 1: 44bda4a Allow member addition in initialdata
@@ -14,10 +14,15 @@
};
Creates a new L<RT::Group> for each hashref. In almost all cases you'll want
-@@
- into L<< RT::Group->LoadByCols >>. Each group found will have the new group
- added as a member.
+ to follow the example above to create a group just as if you had done it from
+ the admin interface. B<Do not> omit the C<< Domain => 'UserDefined' >> line.
+-Additionally, the C<MemberOf> field is specially handled to make it easier to
+-add the new group to other groups. C<MemberOf> may be a single value or an
+-array ref. Each value should be a user-defined group name or hashref to pass
+-into L<RT::Group/LoadByCols>. Each group found will have the new group
+-added as a member.
+-
-Unfortunately you can't specify the I<members> of a group at this time. As a
-workaround, you can push a subref into C<@Final> which adds members to your new
-groups. An example, using a convenience function to avoid repeating yourself:
@@ -55,10 +60,14 @@
- RT->Logger->error("Unable to find group '$group_name'!");
- }
- }
--
++In addition to the C<Members> option shown above, which can take both
++users and groups, the C<MemberOf> field may be a single value or an
++array ref. Each value should be a user-defined group name or hashref to
++pass into L<RT::Group/LoadByCols>. Each group found will have the new
++group added as a member.
+
=head2 C<@Queues>
- push @Queues, {
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
--- a/lib/RT/Handle.pm
@@ -115,7 +124,7 @@
+ $item->{Domain} = 'UserDefined' if $member->isa("RT::Group");
+ $member->LoadByCols( %$item );
+ unless ($member->Id) {
-+ RT->Logger->error("Unable to find $class '$name' to add to ".$group->Name);
++ RT->Logger->error("Unable to find $class '".($item->{id} || $item->{Name})."' to add to ".$group->Name);
+ next;
+ }
+
@@ -130,3 +139,4 @@
if ( @Queues ) {
$RT::Logger->debug("Creating queues...");
for my $item (@Queues) {
+
-: ------- > 2: 58b176d Default the Domain to UserDefined, because that's what 99% will be
More information about the Rt-commit
mailing list