There are multiple reasons to that.
The ships we usually see on-screen are either science vessels, or on scientific missions
There is no need to overly restrict everything on a science vessel, where the risk of being boarded is minimal. The privilege of moving around comes with a certain amount of trust.
We see things mainly from the perspective of trusted crewmen
The people we see moving around the ships are ususally trusted. For example, we never see anybody having difficulties reaching the bridge, because they are actually allowed to be there. That does not mean that no security measures are in place.
Contrast that to TNG: Encounter at Farpoint, where Wesley made his way to the bridge (with the help of his mother), a fact that was immediately pointed out. While Wesley moves around on the bridge, he is under close surveillance of literally everyone on the bridge, and he is thrown out as soon as he oversteps the boundaries.
Wesley on the bridge on YouTube
An even better contrast is Season 1 of Discovery: Michael Burnham is an untrusted person on a vessel with a military mission during times of war, so she sees guards everywhere she goes. Some doors are even secured by Section 31 personnel.
Barclay and Seven are very smart and familiar with the tech
The two examples you mentioned can easily be explained with both people being both very smart and very familiar with the technology - Reg, because he is a gifted engineer well-versed with Federation technology, and Seven because she has superior Borg implants which help her with the Power of Plot.
As an analogy, if I lock my front door, Reg might be able to open it because he is so familiar with my house that he knows that I keep a spare key under the doormat, and Seven might be able to open it because she carries a superior multi tool with her all the time. Since my door is designed to prevent "average" intruders, it has no chance against a guy with inside knowledge or a woman with badass tools.
The computer logs everything, and might be programmed to call out unusual behaviour
The computer usually knows where everyone is at a given time, and not only that, it also knows the last known location, when a shuttle starts, when the transporter is being used (including starting point and destination) and so on. So in case you are trying to manipulate things, it's likely that it's logged somewhere.