I consider both sentences to be incorrect with “when I had the chance” on the end.
(I think I’ve mentioned this before.)
The following sentences would be OK, for example:
I should have [done XXX] when I had the chance.
-OR- I should have let you [do XXX] when I had the chance.
-OR- (similar in meaning to your sentence) I should have forbidden you to [do XXX] when I had the chance.
I didn’t say I don’t like the expression “when I had the chance”. I disagree with the usage in combination with the idea of “never allow something to happen” in the original post.
“When I had the chance” means “when I had the chance to [do what is stated in the first part of the sentence]”. Thus the sentence in the original post can be extended to:
“I never should’ve allowed you to leave this place when I had the chance to never allow/never to allow you to leave this place.” I find this to be incredibly awkward at best.
The expression “when I had the chance” also tends to be used with affirmatives. For example, “I should have kept you from leaving when I had the chance.”
Surely you aren’t suggesting that you have no misgivings whatsoever about the usage of “when I had the chance” in the original post?
I think this order is preferable: either I never should have allowed or I should never have allowed.
The other problem is the juxtaposition of ‘never’ with ‘when’. ‘Never’ is if you like a ‘no’ time - it doesn’t exist. ‘When’ on the other hand is a ‘yes’ time and so does exist. It follows therefore that you can’t refer to a time (using ‘when’) that doesn’t exist.