From 740834abbf5434a60a7ded2c0b48430420e995a9 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sun, 6 Aug 2017 10:11:28 -0700 Subject: rt 4.2.14 (#13852) --- rt/lib/RT/Group.pm | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'rt/lib/RT/Group.pm') diff --git a/rt/lib/RT/Group.pm b/rt/lib/RT/Group.pm index c412ba690..6fca91bbc 100755 --- a/rt/lib/RT/Group.pm +++ b/rt/lib/RT/Group.pm @@ -3,7 +3,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -1107,6 +1107,19 @@ sub _AddMember { unless $ok; } + # Record transactions for UserDefined groups + if ($args{RecordTransaction} && $self->Domain eq 'UserDefined') { + $new_member_obj->Object->_NewTransaction( + Type => 'AddMembership', + Field => $self->PrincipalObj->id, + ); + + $self->_NewTransaction( + Type => 'AddMember', + Field => $new_member, + ); + } + # Record an Add/SetWatcher txn on the object if we're a role group if ($args{RecordTransaction} and $self->RoleClass) { my $obj = $args{Object} || $self->RoleGroupObject; @@ -1312,6 +1325,19 @@ sub _DeleteMember { } } + # Record transactions for UserDefined groups + if ($args{RecordTransaction} && $self->Domain eq 'UserDefined') { + $member_obj->MemberObj->Object->_NewTransaction( + Type => 'DeleteMembership', + Field => $self->PrincipalObj->id, + ); + + $self->_NewTransaction( + Type => 'DeleteMember', + Field => $member_id, + ); + } + return ( $val, $self->loc("Member deleted") ); } @@ -1686,6 +1712,12 @@ sub __DependsOn { ); push( @$list, $objs ); +# Cleanup group's membership transactions + $objs = RT::Transactions->new( $self->CurrentUser ); + $objs->Limit( FIELD => 'Type', OPERATOR => 'IN', VALUE => ['AddMember', 'DeleteMember'] ); + $objs->Limit( FIELD => 'Field', VALUE => $self->PrincipalObj->id, ENTRYAGGREGATOR => 'AND' ); + push( @$list, $objs ); + $deps->_PushDependencies( BaseObject => $self, Flags => RT::Shredder::Constants::DEPENDS_ON, @@ -1741,13 +1773,12 @@ sub PreInflate { return; }; - # Go looking for the pre-existing version of the it + # Go looking for the pre-existing version of it if ($data->{Domain} eq "ACLEquivalence") { $obj->LoadACLEquivalenceGroup( $data->{Instance} ); return $duplicated->() if $obj->Id; - # Update the name and description for the new ID - $data->{Name} = 'User '. $data->{Instance}; + # Update description for the new ID $data->{Description} = 'ACL equiv. for user '.$data->{Instance}; } elsif ($data->{Domain} eq "UserDefined") { $data->{Name} = $importer->Qualify($data->{Name}); -- cgit v1.2.1