Preventing Deletion of certain users in a plugin

I have a requirement to make sure certain users are never deleted from the Community.

I was wondering if it would be possible to create an plugin with a whitelist config and then monitor the UserBeforeDeleteEvent and check the whitelist and if the users username is present then cancel the delete even and log something out.

Is this possible and if so how would I go about cancelling the delete itself?

void UserBeforeDeleteEventHandler(UserBeforeDeleteEventArgs e);

Thanks

Adam

Parents Reply Children