Students have rights, right? Yes, but not many.
Courts have found that pupils have a reduced expectation of privacy on schoolgrounds. The fact that school officials, rather than cops, usually conduct these searches is a complicating factor. Overall, the search-and-seizure rules for students are more lax than where adults are concerned.