In your application, you can manage access rights and privileges by setting up user roles and access rules on entities. With user roles, you can control access to pages and microflows in your application. Access rules on entities will control which user roles can read/write the entities.
In you scenario, you will need to configure two user roles teacher and students.
Please see documentation for details. There is also a full learning path about security