You are correct that he was allowed in by the janitor, which would have made the entry legal if he were there on official business. However, y'all seem to want it both ways. I'd have no problem with a cop attempting this stunt if he wasn't (one more time folks) in uniform and on duty. However, because he was, his request could be reasonably thought to be a legitimate request by the janitor, who obviously has been neglecting his study of constitutional law. There is also the consideration that he was outside of his jurisdiction.
Had I been the janitor, I'd have noted the cop's badge number and department to give to the principle/superintendent in the morning and then told the cop to specify why he wanted admittance, and if not satisfied, tell him to get a warrant and pound sand until it shows.
I really don't understand why people are just begging to give the government limitless authority over them. This is supposed to be a conservative philosophy?