I need to ensure that users have specific permissions before allowing them to substitute a media file. Listening to the MediaService.Saving event does not help due to the behavior described in https://github.com/umbraco/Umbraco-CMS/issues/13214. The file is substituted before the event is called, making it impossible to stop unauthorized user actions. How can I intercept and block media substitution?
Hi Huw, thank you for your answer. Unfortunately the trashing/trashed events are not triggered when a media file is substituted. Instead, only the physical file is deleted and replaced with a different one, without triggering any events. The main problem here is that this happens before the saving event.
Intercept and block media substitution
I need to ensure that users have specific permissions before allowing them to substitute a media file. Listening to the MediaService.Saving event does not help due to the behavior described in https://github.com/umbraco/Umbraco-CMS/issues/13214. The file is substituted before the event is called, making it impossible to stop unauthorized user actions. How can I intercept and block media substitution?
Could you maybe intercept the MediaService.Trashing event instead?
Hi Huw, thank you for your answer. Unfortunately the trashing/trashed events are not triggered when a media file is substituted. Instead, only the physical file is deleted and replaced with a different one, without triggering any events. The main problem here is that this happens before the saving event.
is working on a reply...