public function permissions() {
    $permissions = [];

    $contentTypes = $this->getContentTypes();
    foreach ($contentTypes as $bundle) {
      $entity_type = 'node';
      $fields = $this->getEntityAccessFields($entity_type, $bundle);

      /** @var \Drupal\field\Entity\FieldConfig $field */
      foreach ($fields as $field) {
        $field_storage = $field->getFieldStorageDefinition();
        // @TODO Add support for allowed_values_function.
        $allowed_values = $field_storage->getSetting('allowed_values');
        if (!empty($allowed_values)) {
          foreach ($allowed_values as $field_key => $field_label) {
            if (!in_array($field_key, $this->getIgnoredValues())) {
              // e.g. label = node.article.field_content_visibility:public.
              $permission_label = $field->id() . ':' . $field_key;
              $permission = 'view ' . $permission_label . ' content';
              $permissions[$permission] = [
                'title' => $this->t('View @label content', ['@label' => $permission_label]),
              ];
            }
          }
        }
      }
    }

    return $permissions;
  }