Usually the X-Ray machine is operated from an exterior control booth. If this is the set up then the operator usually turns on the light and is responsible for making sure no one enters the room at that time. They usually post signs saying not to enter if the light is on.

If the equipment is operated by a technician who is in the room (and hopefully in a lead vest) then they usually turn on the light and lock the door.

Some X-Ray equipment has an auxillary contact output that is ran to a control panel. The control panel has the required circuits to turn the light on.

For the most part it is the technicians responsibility to ensure no one comes in when the X-Ray machine is in operation.

(All this information is from X-Ray Tech's that I know that have been doing this since 1983 military and civilian.)