Josh technically outranked Toby, but he wasn't his boss, if that makes sense. Toby reported directly to Leo, as did Josh. So, yeah, Toby was Sam and C.J.'s boss, but though Josh outranked them, he wasn't their boss too, because Sam and C.J. were in the Communications department, and Josh's job didn't have to do with that.
Really, the only way in which Josh outranking Toby manifested itself was that Josh had higher clearance than Toby. He was the only one who was eligible to be placed in that bunker in the event of a nuclear attack, he was the only one involved in the discussions of Leo's censure, etc.
Doesn't that come down to the presidency? No matter who does what, it is the president who is responsible. I think Josh covered that point during '20 Days in America'(my favourite episodes). When it is in the Oval, it is the president who take responsibility.