Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michele Benolli 31 posts 149 karma points
    Mar 09, 2023 @ 08:25
    Michele Benolli
    0

    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?

  • Huw Reddick 1932 posts 6722 karma points MVP 2x c-trib
    Mar 13, 2023 @ 12:25
    Huw Reddick
    0

    Could you maybe intercept the MediaService.Trashing event instead?

  • Michele Benolli 31 posts 149 karma points
    Mar 14, 2023 @ 06:37
    Michele Benolli
    0

    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.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies