Assigning permissions based on taxonomies
Organic Groups sounds like a better way to go in this situation. Each class is a group (can still categorize them using taxonomy), but will give you the sub-permissions you require per class (group) (e.g. teacher being able to enroll and administer their own group and students only being able to submit content in their own class)

OG enables users to create and manage their own 'groups'. Each group can have subscribers, and maintains a group home page where subscribers communicate amongst themselves.

They do so by posting the usual node types: blog, story, page, etc. A block is shown on the group home page which facilitates these posts. The block also provides summary information about the group.

Groups may be selective or not. Selective groups require approval in order to become a member, or even invitation -only groups. There are lots of preferences to configure groups as you need.