It's against human rights to invade your privacy, they can't go in your bedroom let alone your closet, unless there is something they need to fix for your safety or for keeping the building in proper maintenance. They can give 24hrs notice, but you can sometimes still tell them they're not allowed in. If they give 24 hours notice to fix a plumbing problem, you may have to let them in, but if they give 24 hours notice that they're going to change your screens on your bedroom windows you can say no thank-you. If they're in your kitchen fixing plumbing they aren't allowed in your bedroom or bathroom.
In regards to your roomates locked room question, if someone on the lease lets the landlord in, it's not illegal. It's like being invited into a home, just because one person doesn't want you int there doesn't mean you legally have to leave. If you're invited in by a resident, you're a guest.
The only time they can go in your apartment without any warning, is if they need to in order to fix something that could ruin the building, or risk the safety of other tennants (ie if your place is flooding out into the hallway, they can go in and fix immediately).
I'm assuming you're worried about a landlord finding a grow/stash, but I wouldn't worry too too much because they will never take the stash from you, so you can always get rid of it and then ask them wtf they are talking about and deny the entire thing.