At the time the boy was admitted, many organisations accepted the line being pushed by Stonewall and trans activists that excluding trans identifying males from women only spaces was unlawful discrimination. To be fair to trans activists, the debates in parliament on the Gender Recognition Act suggest that politicians thought they were making it illegal to exclude trans identifying males from women only spaces. I therefore suspect those involved in the decision to admit this boy believed they were following the law and had no choice but to admit him. However, the Supreme Court in For Women Scotland has now decided that references to sex in the Equality Act are to biological sex.
There is still a rearguard action being fought in the courts by and on behalf of trans activists - see, for example, Peggie vs NHS Fife and Kelly vs Leonardo UK, in both of which the Employment Tribunal came up with decisions that appear contrary to the Supreme Court's decision. However, unless parliament chooses to change the law (which is possible - there are many in Labour who support the trans activist side of the debate and the Greens, who are very much in the trans camp, are riding high in the polls), everyone is going to have to fall in line. As things stand, any girl at this school who objects to the presence of a boy may have a case for unlawful harassment.