Depends on the policies of your country, any sub-governments (like in U.S. State, County, & City), whether or not the school is public or private, and what you mean by allowed, like allowed by the core policies, or allowed by implementation of those policies.
In U.S. by the core policies of public access of public institutions it is technically not kosher to restrict a citizen's access to public space/institutions, so a public school should TECHNICALLY allow any US citizen full access to the school's internet, gym, etc. By that logic though hunting permits could only be issued by private land owners for their own lands, library cards & late fees are bs, and curfews on public parks are illegal. Obviously, none of that is the case because the ways that we implement the policies allow for all of those restrictions, with which restricting your internet use is pretty much in line with. If the school is privatized then anything short of publicly flogging you is pretty much within their right.
So if it is a US public school, it is not allowed, but every court in the country allows it.