I have a friend who regularly drives without a shirt on during summer since he refuses to turn on his AC if he can avoid it. He works on a military base, and as such has to pass a security point every morning where he has to show his badge to be allowed on base.
He has told me that about 1/3 of the time the guard's manning the check point will require him to put his shirt on before allowing him to drive onto the base.
Do these guard's have a legal right to require him to put on his shirt? I suspect the answer is no, I'm pretty confident that the man has the right to drive without a shirt when on regular roads, and I doubt that federal bases have any law explicitly written to require him to wear a shirt.
Assuming that there is no law requiring him to put on his shirt would he technically have legal recourse for his rights being violated, as the guard was compelling my friend to act based off of presumed legal authority imposed by the federal government he worked for? Admittedly I doubt that the 'harm' of having to put on a shirt is severe enough to warrant perusing, or would lead to any significant compensation if it was found he was wronged, but I'm curious what his theoretical recourse would be.
Since he is entering a federal base I believe only federal law matters, so his specific state shouldn't be relevant as I understand.