Encounter at Farpoint (2) - S1-E2
Stupidity: Picard has to stop Worf from blasting a hole into the front visor of the bridge when Q appears in it. Even back in the XX century nobody would try to shoot at the TV screen because something appears in it (our TVs being also placed generally in less important positions)! And someone with this degree of imbecility is the high ranking security officer, even.
Answer: Yes. The doors to the holodecks can be locked when in use by anyone aboard the Enterprise so they couldn't be disturbed. However, high ranking officers like Captain Picard could override the doors as it's seen that overrides are in use even for the crews quarters. Even Barclay, when he's indulging in one of his fantasies could have the doors to the holodeck unlocked by an override code.