We basically 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. If the form has any webhooks I would then check the user type and present an error message if it isn't a extended web editor. The problem is that I cannot figure out a way way to access the webhooks information.
Any insight would be greatly appreciated.
I think you are on the right track. Hook into the PublishingContent event, and check the propertyin this way:
It's not strongly typed, so you will not get the autocomplete in Visual Studio.
The webhook property is not part of the strongly typed properties on the FormContainer block, but you should be able to get it by doing as you've done with creating the handler, typecheck and cast e.Content to FormContainer and then getting the webhooks like this:
Thank you Tomas and Jørgen! I had not realized that since we use a custom actor the name of the property must match that class name. This is basically what I had to to:myBlock.GetPropertyValue<IEnumerable<CustomWebhookActorModel>>("CustomCallWebhookAfterSubmissionActor")
Same same, but with a slight twist. Your answers made me understand that the webhook information really should be accessible and after awhile the penny dropped all the way :)