I'm trying to cancel the saving of an existing media by subscribing to MediaService.Saving event and it works for the properties by calling ResetDirtyProperties on each media in SavedEntities, but the old media file is deleted/replaced before the Saving event is called so while the media filename is reset to the old name though the physic file doesn't exist anymore in the filesystem (so basically it seems that the changes to the filesystem is happening before Saving has been completed or cancelled).
I also tried to register IMediaService interface to a custom service inheriting from MediaService where I tried to override the DeleteMediaFile method where I tried don't delete the file under specific conditions but it seems that this custom service doesn't replace the original MediaService and so it isn't called at all during the media saving operation.
Is there a way to work around this? I'd need this because Umbraco CMS is missing a backend permissions section for Media, it only provides permissions for Content, a section in User Group to set the permissions on Media (create/update/delete) would be awesome.
Old media file is replaced before Saving event
I'm trying to cancel the saving of an existing media by subscribing to MediaService.Saving event and it works for the properties by calling ResetDirtyProperties on each media in SavedEntities, but the old media file is deleted/replaced before the Saving event is called so while the media filename is reset to the old name though the physic file doesn't exist anymore in the filesystem (so basically it seems that the changes to the filesystem is happening before Saving has been completed or cancelled).
I also tried to register IMediaService interface to a custom service inheriting from MediaService where I tried to override the DeleteMediaFile method where I tried don't delete the file under specific conditions but it seems that this custom service doesn't replace the original MediaService and so it isn't called at all during the media saving operation.
Is there a way to work around this? I'd need this because Umbraco CMS is missing a backend permissions section for Media, it only provides permissions for Content, a section in User Group to set the permissions on Media (create/update/delete) would be awesome.
is working on a reply...