X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FGroup.pm;h=6fca91bbc7ba82d983f6053bad077c3d1ca24b7d;hb=70e31cdfd01949235897035ad818e9a7b2d0c958;hp=b79f4740c037913699d6f20704669884030c9286;hpb=0ed195595b5c7ea404c8848d9d1881ada4214489;p=freeside.git diff --git a/rt/lib/RT/Group.pm b/rt/lib/RT/Group.pm index b79f4740c..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-2015 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});