Altering Entity View to Add Cache Contexts
/**
* Implements hook_entity_view_alter() to add cache contexts.
*/
function my_module_entity_view_alter(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {
$build['#cache']['contexts'][] = 'user.permissions';
}