Search code examples
formswebhooksepiserver

Is there a way to base the rights to publish a form in Episerver based on the presence of webhooks?


We use two user groups in Episerver, web editors and extended web editors. Normally, both should be able to create and publish forms. However, only extended web editors should be able to publish a form if one or more webhooks have been specified. How, if at all possible, can this be achieved?

My initial thought was to use an InitializationModule and add a handler for the PublishingContent event, but I have not figured out a way way to access the webhooks information.

Any insight would be greatly appreciated.


Solution

  • Using the PublishingContent event worked fine and I got the answer I needed regarding the webhooks info on: world.episerver.com/forum/developer-forum

    My mistake was to do this when trying to access this info:

    myBlock.Property["CallWebhookAfterSubmissionActor"]
    

    From this I could extract a list of webhooks, but it was always empty. What I had not realized was that since we are using a custom actor, the name of the property must match the name of that class. This is basically what I ended up with:

    myBlock.GetPropertyValue<IEnumerable<CustomWebhookActorModel>>("CustomCallWebhookAfterSubmissionActor")