Where I work, we always have 2 people in the flight deck. If one pilot needs to use the toilet one cabin attendant is required to be present in the flight deck but they are not allowed to seat anywhere but on the jumpseat and they are not allowed to touch any controls.