fix #11964 files show in trash and old revisions

This commit is contained in:
Doug Bell 2010-11-16 17:54:08 -06:00
parent 336075784c
commit 55920f59e0
5 changed files with 224 additions and 34 deletions

View file

@ -92,6 +92,24 @@ sub setPrivileges {
);
}
#----------------------------------------------------------------------------
=head2 commit ( )
Override commit to remove all privileges for previous revisions' storage
locations
=cut
sub commit {
my ( $self, @args ) = @_;
for my $rev ( grep { $_->get("revisionDate") < $self->get("revisionDate") } @{$self->getRevisions} ) {
$rev->getStorageLocation->trash;
}
return $self->SUPER::commit( @args );
}
#-------------------------------------------------------------------
@ -430,7 +448,6 @@ sub processPropertiesFromFormPost {
return undef;
}
#-------------------------------------------------------------------
=head2 purge
@ -479,6 +496,20 @@ sub purgeRevision {
#----------------------------------------------------------------------------
=head2 restore ( )
Override trash restore to restore storage location
=cut
sub restore {
my ( $self, @args ) = @_;
$self->setPrivileges;
return $self->SUPER::restore( @args );
}
#----------------------------------------------------------------------------
=head2 setFile ( [pathtofile] )
Tells the asset to do all the postprocessing on the file (setting privs, thubnails, or whatever).
@ -561,6 +592,23 @@ sub setStorageLocation {
}
}
#----------------------------------------------------------------------------
=head2 trash ( )
Override to put the attached file in the trash too
=cut
sub trash {
my ( $self, @args ) = @_;
my $return = $self->SUPER::trash( @args );
$self->getStorageLocation->trash;
return $return;
}
#-------------------------------------------------------------------
=head2 update