X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FGroup.pm;h=eb7940142a186104eb39fd38aebe7cbe47c51cb8;hb=44dd00a3ff974a17999e86e64488e996edc71e3c;hp=c412ba69068ce3ed03476572229767435767c4a9;hpb=7322f2afedcc2f427e997d1535a503613a83f088;p=freeside.git diff --git a/rt/lib/RT/Group.pm b/rt/lib/RT/Group.pm index c412ba690..eb7940142 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-2019 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});