docs: def check_public_permissions(payload):
      """Raise ``PermissionDenied`` if public permissions are too open."""
      allowed_public_permissions = ['view', 'add', 'download']
      for perm_type in ['add', 'remove']:
          for perm in payload.get('public', {}).get(perm_type, []):
              if perm not in allowed_public_permissions:
                  raise exceptions.PermissionDenied("Permissions for public users are too open")