The Field Permissions module in Drupal 8 allows you to set permissions (enter, edit or view) on a Drupal field, based on the role the user belongs to.
In order to demonstrate how this module works, we are going to create a content type called "Essay" for the website of a school.
There will be 2 roles:
Freshmen permission will not be allowed to choose the subject of the essay, whereas the
Sophomores will have the possibility to choose between literature and history. However, there will be no possibility to change the subject once a student has made a choice.