Customize "view modes" and "form modes" based on role Drupal 8 has extended the View Modes concept to Form modes


Is it possible to assign a role to both "View Modes" and "Form Modes"?
How does one assign a mode both view mode or form mode to be shown at a particular place ? Say I wish to Full content view mode shown at certain page and Teaser view mode show in a block at another location. Similarly I want form mode A show during create and form B during edit.


For example there is a content type with following Fields


Title : displayed publicly, editable by author 
Body : displayed publicly, editable by author 
Project code : Not displayed publicly, displayed and editable by author 
System code : only visible/editable by admin


Essentially this could be an interesting and performant way to implement field permissions. The field permissions module has no port for Drupal 8 yet.
Nothing in core uses form modes - it's an API waiting for contrib to make use of.
This, and the question of when to manipulate form fields and when form modes, is discussed at:
https://www.drupal.org/node/2530086.

There Berdir says "Showing/Hiding fields but keep them otherwise the same is IMHO a perfect use case for hook_entity_field_access() not switching out the form display. I'd only try to do something like [switching form  mode] when you want to show different widgets based on the user roles."

In general, managing display differently for different roles is easy, managing forms differently is more difficult.

Alternatives to the field permissions module for managing display (NOT forms):

The classic answer might be that this is a job for the Panels family, but it's mostly not quite ready for D8.  Page manager is however quite usable and does much of what you want. For specifically created pages, it can control the content based on role. What it won't do is take over the rendering of all nodes of a certain content type.

Display suite is D8 ready, and allows you to show fields based on permissions by using token fields. See https://swsblog.stanford.edu/blog/using-display-suite-provide-field-level-permissions for a description of the procedure in D7, which is only cosmetically changed for D8.