[Rt-commit] rt branch, 4.4/delete-asset-multiple-holders, created. rt-4.4.4-140-g76f711cee4

Aaron Trevena ast at bestpractical.com
Tue Sep 15 06:13:16 EDT 2020


The branch, 4.4/delete-asset-multiple-holders has been created
        at  76f711cee471936e8d168d04a36de4b3beccb703 (commit)

- Log -----------------------------------------------------------------
commit 76f711cee471936e8d168d04a36de4b3beccb703
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Tue Sep 15 11:09:47 2020 +0100

    Fix error when removing multiple holders of an asset
    
    Removing more than one holder for an asset failed with the following error:
    "Could not load user 'ARRAY(0xa38ce70).".
    
    Add logic to check for and handle multiple values in RemoveRoleMember-HeldBy
    form parameter.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index af03da1e4b..a8d382fe00 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -4182,14 +4182,17 @@ sub ProcessAssetRoleMembers {
                 $is = $1;
             }
 
-            my ($ok, $msg) = $object->$method(
-                Type        => $role,
-                ($ARGS{$arg} =~ /\D/
-                    ? ($is => $ARGS{$arg})
-                    : (PrincipalId => $ARGS{$arg})
-                ),
-            );
-            push @results, $msg;
+            my @members = (ref($ARGS{$arg}) eq 'ARRAY' ) ? ( @{$ARGS{$arg}} ) : ( $ARGS{$arg} ) ;
+            foreach my $member (@members) {
+                my ($ok, $msg) = $object->$method(
+                    Type        => $role,
+                    ($member =~ /\D/
+                     ? ($is => $member)
+                     : (PrincipalId => $member)
+                 ),
+                );
+                push @results, $msg;
+            }
         }
         elsif ($arg =~ /^RemoveAllRoleMembers-(.+)$/) {
             my $role = $1;

-----------------------------------------------------------------------


More information about the rt-commit mailing list