docs: def _process_permission(perm):
      """Rebuild indexes affected by the given permission."""
      # XXX: Optimize: rebuild only permissions, not whole document
      codename = perm.permission.codename
      if not codename.startswith('view') and not codename.startswith('owner'):
          return
  
      index_builder.build(perm.content_object)