gramps-webapi 3.25.2__tar.gz → 3.25.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/PKG-INFO +1 -1
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/_version.py +1 -1
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/cache.py +12 -5
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/file.py +2 -3
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/base.py +21 -8
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/oidc.py +7 -4
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/util.py +4 -1
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/tasks.py +8 -3
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/app.py +9 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/auth/oidc.py +10 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/config.py +3 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/PKG-INFO +1 -1
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/SOURCES.txt +1 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_file.py +16 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_filters.py +52 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_oidc.py +63 -8
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_transactions.py +27 -2
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_file.py +15 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_import_util.py +24 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_oidc_auth.py +53 -0
- gramps_webapi-3.25.3/tests/test_proxy_fix.py +104 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.devcontainer/Dockerfile +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.devcontainer/devcontainer.json +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.devcontainer/docker-compose.yml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.dockerignore +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.editorconfig +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.flake8 +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.github/workflows/base-image-pr.yml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.github/workflows/base-image.yml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.github/workflows/image.yml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.github/workflows/pypi.yml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.github/workflows/test.yml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.gitignore +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.pre-commit-config.yaml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.pylintrc +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.vscode/extensions.json +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.vscode/launch.json +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.vscode/settings.json +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/.vscode/tasks.json +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/AGENTS.md +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/CLAUDE.md +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/CODE_OF_CONDUCT.md +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/CONTRIBUTING.md +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/Dockerfile +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/Dockerfile.base +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/LICENSE +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/MANIFEST.in +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/README.md +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/ROADMAP.md +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic.ini +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/README +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/env.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/script.py.mako +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/2082445b0769_add_oidc_accounts_table_for_secure_.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/22c8d1fba959_add_trees_enabled.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/4b7f9d2e6c01_add_web_push_subscriptions.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/66e56620891a_add_trees_table.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/6d8f3cb50b71_add_persistent_access_tokens_table.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/7b2e9f4c1a63_allow_several_access_tokens_per_scope.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/84960b7d968c_use_bigint_for_quota_media.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/9c4d2e7a5b18_track_task_lifecycle.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/a8e57fe0d82e_add_columns_for_ai_quota.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/b0582f54029c_use_bigint_for_usage_media.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/b2c3d4e5f6a7_add_tree_config_column.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/b6f1d3a9c2e4_add_token_version_to_user.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/c1d2e3f4a5b6_merge_task_tree_and_tree_config.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/c89728e71264_.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/d4e9a1c7b3f2_drop_unique_constraint_on_user_email.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/e176543c72a8_add_tree_column_to_user.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/e5e738d09fa7_added_configuration_table.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/alembic_users/versions/f3a1c8e92b47_add_task_tree_table.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/docker-entrypoint.sh +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/__main__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/access/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/access/db.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/access/policy.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/access/sanitize.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/auth.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/backup.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/backup_store.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/blueprint.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/check.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/deprecations.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/dna.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/emails.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/export.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/faces.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/html.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/image.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/agent.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/deps.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/render.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/tools.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/media.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/media_importer.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/people_families_cache.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/ratelimiter.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/report.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/access_tokens.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/anniversaries.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/backups.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/bookmarks.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/chat.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/citations.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/config.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/db_backend.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/delete.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/dna.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/emit.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/events.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/export_media.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/exporters.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/face_detection.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/facts.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/families.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/file.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/filter_param_types.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/filters.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/history.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/holidays.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/import_media.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/importers.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/living.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/match.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/media.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/merge.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/metadata.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/name_formats.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/name_groups.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/notes.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/object_query.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/objects.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/ocr.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/oidc_accounts.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/people.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/places.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/push_subscriptions.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/relations.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/reports.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/repositories.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/restore.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/schemas.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/search.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/sort.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/sources.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/tags.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/tasks.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/timeline.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/token.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/transactions.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/translations.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/trees.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/types.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/user.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/verify.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/ydna.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/s3.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/search/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/search/indexer.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/search/query.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/search/schema.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/search/text.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/snapshot.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/telemetry.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/api/util.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/auth/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/auth/const.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/auth/oidc_helpers.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/auth/passwords.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/auth/sql_guid.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/celery.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/const.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/data/empty_gramps_auth.cfg +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/data/example_gramps_auth.cfg +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/data/face_detection_yunet_2023mar.onnx +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/data/test_auth.cfg +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/dbloader.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/dbmanager.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/future_gramps/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/future_gramps/alive.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/future_gramps/relationship.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/logging_utils.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/profiler.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/sentry.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/static/index.html +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/templates/confirmation.html +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/templates/reset_password.html +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/templates/reset_password_base.html +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/templates/reset_password_error.html +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/translogger.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/types.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/undodb.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/util/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/util/celery.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/util/task_state.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/verify_lib.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/webpush.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi/wsgi.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/dependency_links.txt +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/requires.txt +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/top_level.txt +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/mypy.ini +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/pyproject.toml +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/requirements-dev.txt +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/scripts/s3_rename.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/scripts/search_benchmark.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/scripts/start_dev_container.sh +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/setup.cfg +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/setup.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/conftest.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_access.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_celery_logging.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_check.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_cli.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_close_db.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_db.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_delete.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_deprecations.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_dna_match_parser.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/__init__.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/checks.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_access_tokens.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_anniversaries_ics.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_backups.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_bookmarks.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_chat.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_citations.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_config.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_db_handle.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_delete.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_dna.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_etag.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_events.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_exporters.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_facts.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_families.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_history.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_holidays.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_import_media.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_importers.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_list_paging.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_living.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_media.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_media_archive.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_media_usage_sync.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_merge.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_metadata.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_name_formats.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_name_groups.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_notes.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_object_query.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_object_query_where_tree.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_ocr.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_oidc_accounts.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_oidc_link.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_paging_sort.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_people.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_people_query.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_place_coordinates.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_places.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_post.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_profiler.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_push_subscriptions.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_put.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_ready.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_relations.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_repair.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_reports.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_repositories.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_restore.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_s3.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_search.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_sources.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_tags.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_tasks.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_timelines.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_token.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_token_revocation.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_token_sync.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_translations.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_treeless_admin.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_trees.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_types.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_upload.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_user.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_verify.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_webpush_delivery.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/test_ydna.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_endpoints/util.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_face_detection.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_future_gramps_alive.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_future_gramps_relationship.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_image.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_jwt.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_limiter.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_llm_agent.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_llm_errors.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_llm_history.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_llm_render.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_llm_tools.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_logging_utils.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_map_tile.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_media_importer.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_media_prefix_tree.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_migrate_grampsdb.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_missing_references.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_object_query_parsing.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_openapi_operation_ids.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_password.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_postgres_driver.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_privacy_canary.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_private_proxy.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_private_proxy_backlinks.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_s3.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_search_api_updates.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_search_index.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_search_oracle.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_search_text.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_sentry.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_server_locale.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_shared_postgresql.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_snapshot.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_sort_raw_data.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_sort_sql.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_sqlauth.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_static_files.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_task_error.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_task_state.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_tasks.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_telemetry.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_undodb.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_user_db_migration.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_util.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_verify_lib.py +0 -0
- {gramps_webapi-3.25.2 → gramps_webapi-3.25.3}/tests/test_version.py +0 -0
|
@@ -145,8 +145,9 @@ def is_cacheable_response(rv) -> bool:
|
|
|
145
145
|
"""Only cache successful responses.
|
|
146
146
|
|
|
147
147
|
Since Flask-Caching 2.5.0, an exception raised by `abort()` is cached as
|
|
148
|
-
well. An error can depend on the server rather than the tree
|
|
149
|
-
that isn't installed yet), so it must not be served
|
|
148
|
+
well. An error can depend on the server rather than the tree or the file
|
|
149
|
+
(e.g. an addon or OpenCV that isn't installed yet), so it must not be served
|
|
150
|
+
until the tree changes, or for good from the thumbnail cache.
|
|
150
151
|
The view may return something other than a `Response`, e.g. a string.
|
|
151
152
|
"""
|
|
152
153
|
return getattr(rv, "status_code", 200) < 400
|
|
@@ -181,7 +182,9 @@ def request_cache_decorator(f: Callable) -> Callable:
|
|
|
181
182
|
|
|
182
183
|
|
|
183
184
|
thumbnail_cache_decorator = thumbnail_cache.cached(
|
|
184
|
-
make_cache_key=make_cache_key_thumbnails,
|
|
185
|
+
make_cache_key=make_cache_key_thumbnails,
|
|
186
|
+
unless=skip_cache_missing_media,
|
|
187
|
+
response_filter=is_cacheable_response,
|
|
185
188
|
)
|
|
186
189
|
|
|
187
190
|
|
|
@@ -248,7 +251,9 @@ def make_cache_key_tiles(*args, **kwargs):
|
|
|
248
251
|
|
|
249
252
|
|
|
250
253
|
tile_cache_decorator = thumbnail_cache.cached(
|
|
251
|
-
make_cache_key=make_cache_key_tiles,
|
|
254
|
+
make_cache_key=make_cache_key_tiles,
|
|
255
|
+
unless=skip_cache_missing_media,
|
|
256
|
+
response_filter=is_cacheable_response,
|
|
252
257
|
)
|
|
253
258
|
|
|
254
259
|
|
|
@@ -271,7 +276,9 @@ def make_cache_key_face_detection(*args, **kwargs):
|
|
|
271
276
|
|
|
272
277
|
|
|
273
278
|
face_detection_cache_decorator = thumbnail_cache.cached(
|
|
274
|
-
make_cache_key=make_cache_key_face_detection,
|
|
279
|
+
make_cache_key=make_cache_key_face_detection,
|
|
280
|
+
unless=skip_cache_missing_media,
|
|
281
|
+
response_filter=is_cacheable_response,
|
|
275
282
|
)
|
|
276
283
|
|
|
277
284
|
|
|
@@ -33,7 +33,6 @@ from gramps.gen.db.base import DbReadBase
|
|
|
33
33
|
from gramps.gen.errors import HandleError
|
|
34
34
|
from gramps.gen.lib import Media
|
|
35
35
|
from PIL import Image
|
|
36
|
-
from werkzeug.datastructures import FileStorage
|
|
37
36
|
|
|
38
37
|
from gramps_webapi.const import MIME_AVIF, MIME_PNG
|
|
39
38
|
|
|
@@ -341,8 +340,8 @@ def upload_file_local(
|
|
|
341
340
|
raise ValueError(f"File {path} is not within the base directory.")
|
|
342
341
|
# create folders if necessary
|
|
343
342
|
os.makedirs(path.parent, exist_ok=True)
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
with open(path, "wb") as out:
|
|
344
|
+
shutil.copyfileobj(stream, out)
|
|
346
345
|
|
|
347
346
|
|
|
348
347
|
def get_checksum(fp) -> str:
|
|
@@ -672,19 +672,32 @@ class GrampsObjectsResource(GrampsObjectResourceHelper, Resource):
|
|
|
672
672
|
objects.append(self.full_object(obj, args, locale=locale))
|
|
673
673
|
return self.response(200, objects, args, total_items=total_items)
|
|
674
674
|
|
|
675
|
-
# load all objects to memory
|
|
676
|
-
objects_name = GRAMPS_OBJECT_PLURAL[self.gramps_class_name]
|
|
677
|
-
iter_objects_method = self.db_handle.method("iter_%s", objects_name)
|
|
678
|
-
assert iter_objects_method is not None # type checker
|
|
679
675
|
# ordered by handle, so ties are broken like in sort_handles_by_raw_data
|
|
680
|
-
objects = sorted(iter_objects_method(), key=lambda obj: obj.handle)
|
|
681
|
-
|
|
682
676
|
if "filter" in args or "rules" in args:
|
|
683
|
-
handles
|
|
677
|
+
# filter the handles before loading objects, so that only the
|
|
678
|
+
# matching objects are loaded (rules evaluated in SQL, like
|
|
679
|
+
# MatchesQuery, load no other object at all)
|
|
680
|
+
handles = sorted(query_method())
|
|
684
681
|
matching = set(
|
|
685
682
|
apply_filter(self.db_handle, args, self.gramps_class_name, handles)
|
|
686
683
|
)
|
|
687
|
-
objects = [
|
|
684
|
+
objects = []
|
|
685
|
+
for handle in handles:
|
|
686
|
+
if handle not in matching:
|
|
687
|
+
continue
|
|
688
|
+
try:
|
|
689
|
+
obj = self.get_object_from_handle(handle)
|
|
690
|
+
except HandleError:
|
|
691
|
+
# object was deleted after the handles were fetched
|
|
692
|
+
continue
|
|
693
|
+
if obj is not None:
|
|
694
|
+
objects.append(obj)
|
|
695
|
+
else:
|
|
696
|
+
# load all objects to memory
|
|
697
|
+
objects_name = GRAMPS_OBJECT_PLURAL[self.gramps_class_name]
|
|
698
|
+
iter_objects_method = self.db_handle.method("iter_%s", objects_name)
|
|
699
|
+
assert iter_objects_method is not None # type checker
|
|
700
|
+
objects = sorted(iter_objects_method(), key=lambda obj: obj.handle)
|
|
688
701
|
|
|
689
702
|
if "gql" in args:
|
|
690
703
|
try:
|
|
@@ -142,11 +142,13 @@ def _validate_tree_id(tree_id: str | None) -> str | None:
|
|
|
142
142
|
|
|
143
143
|
Mirrors the checks the registration endpoint applies, so that an OIDC login
|
|
144
144
|
cannot create an account somewhere a registration could not.
|
|
145
|
+
|
|
146
|
+
The tree is optional even in a multi-tree setup: an identity that is already
|
|
147
|
+
linked to an account logs into that account's tree. Only creating a new
|
|
148
|
+
account needs one, which create_or_update_oidc_user() enforces.
|
|
145
149
|
"""
|
|
146
150
|
is_multi = current_app.config["TREE"] == TREE_MULTI
|
|
147
151
|
if not tree_id:
|
|
148
|
-
if is_multi:
|
|
149
|
-
abort_with_message(422, "tree is required")
|
|
150
152
|
return None
|
|
151
153
|
if not is_multi:
|
|
152
154
|
# In a single-tree setup TREE holds the tree *name*, not the tree ID.
|
|
@@ -384,8 +386,9 @@ class OIDCLoginQueryArgs(Schema):
|
|
|
384
386
|
required=False,
|
|
385
387
|
metadata={
|
|
386
388
|
"description": (
|
|
387
|
-
"ID of the tree to associate with the OIDC login.
|
|
388
|
-
"
|
|
389
|
+
"ID of the tree to associate with the OIDC login. In multi-tree"
|
|
390
|
+
" installations, required to create a new account, but not to"
|
|
391
|
+
" log into an existing one. Optional in single-tree ones."
|
|
389
392
|
" Ignored when linking."
|
|
390
393
|
)
|
|
391
394
|
},
|
|
@@ -2247,8 +2247,11 @@ def run_import(
|
|
|
2247
2247
|
if delete:
|
|
2248
2248
|
os.remove(file_name)
|
|
2249
2249
|
if not result:
|
|
2250
|
+
# The importers report unreadable input (corrupt file, invalid
|
|
2251
|
+
# XML, unsupported version) via notify_error and an empty
|
|
2252
|
+
# result, so this is the client's file, not a server fault.
|
|
2250
2253
|
abort_with_message(
|
|
2251
|
-
|
|
2254
|
+
422, "\n\n".join(["Import failed", *user.error_messages])
|
|
2252
2255
|
)
|
|
2253
2256
|
return truncate_import_report(user.error_messages + user.info_messages)
|
|
2254
2257
|
return []
|
|
@@ -922,9 +922,14 @@ def process_transactions(
|
|
|
922
922
|
message: str = "Raw transaction",
|
|
923
923
|
):
|
|
924
924
|
"""Process a set of database transactions, updating search indices as needed."""
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
925
|
+
try:
|
|
926
|
+
trans_dict = apply_transactions(
|
|
927
|
+
tree=tree, user_id=user_id, payload=payload, force=force, message=message
|
|
928
|
+
)
|
|
929
|
+
except ValueError as exc:
|
|
930
|
+
# a rejected transaction is the client's error, as in the synchronous
|
|
931
|
+
# endpoint; aborting makes the task report it as a 400 rejection
|
|
932
|
+
abort_with_message(400, str(exc))
|
|
928
933
|
update_search_indices_from_transaction(
|
|
929
934
|
trans_dict=trans_dict, tree=tree, user_id=user_id
|
|
930
935
|
)
|
|
@@ -35,6 +35,7 @@ from gramps.gen.config import set as setconfig
|
|
|
35
35
|
from gramps.gen.db.utils import get_dbid_from_path
|
|
36
36
|
from gramps.gen.errors import HandleError
|
|
37
37
|
from PIL import Image
|
|
38
|
+
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
38
39
|
|
|
39
40
|
from .api import api_blueprint
|
|
40
41
|
from .api.cache import persistent_cache, request_cache, thumbnail_cache
|
|
@@ -112,6 +113,14 @@ def create_app(config: Optional[Dict[str, Any]] = None, config_from_env: bool =
|
|
|
112
113
|
if not app.config.get(option):
|
|
113
114
|
raise ValueError(f"{option} must be specified")
|
|
114
115
|
|
|
116
|
+
# trust X-Forwarded-For from this many reverse proxies, so that
|
|
117
|
+
# request.remote_addr (used e.g. as rate limiting key) is the client's IP;
|
|
118
|
+
# x_proto defaults to 1 in ProxyFix, so disable it explicitly
|
|
119
|
+
if proxy_fix_x_for := int(app.config.get("PROXY_FIX_X_FOR") or 0):
|
|
120
|
+
app.wsgi_app = ProxyFix( # type: ignore[method-assign]
|
|
121
|
+
app.wsgi_app, x_for=proxy_fix_x_for, x_proto=0
|
|
122
|
+
)
|
|
123
|
+
|
|
115
124
|
# pin the driver once, so every user of the config gets psycopg2
|
|
116
125
|
app.config["USER_DB_URI"] = pin_postgres_driver(app.config["USER_DB_URI"])
|
|
117
126
|
|
|
@@ -384,6 +384,16 @@ def create_or_update_oidc_user(
|
|
|
384
384
|
return existing_user_id
|
|
385
385
|
|
|
386
386
|
# Step 2: Create new user account (email linking removed for security)
|
|
387
|
+
|
|
388
|
+
# In a multi-tree setup a new account must belong to a tree, and only the
|
|
389
|
+
# login request can say which one (e.g. from a tree's registration link).
|
|
390
|
+
# Without it, refuse rather than create an account that belongs to no tree.
|
|
391
|
+
if not tree_id and current_app.config["TREE"] == TREE_MULTI:
|
|
392
|
+
raise ValueError(
|
|
393
|
+
"No account is linked to this identity. To create a new account,"
|
|
394
|
+
" use the registration link of your family tree."
|
|
395
|
+
)
|
|
396
|
+
|
|
387
397
|
logger.info(f"Creating new OIDC user for {provider_id}:{subject_id}")
|
|
388
398
|
|
|
389
399
|
# Generate a clean username - for custom providers use the display username as-is,
|
|
@@ -52,6 +52,9 @@ class DefaultConfig(object):
|
|
|
52
52
|
EMAIL_USE_STARTTLS = None
|
|
53
53
|
DEFAULT_FROM_EMAIL = ""
|
|
54
54
|
BASE_URL = "http://localhost/"
|
|
55
|
+
# number of trusted reverse proxies setting X-Forwarded-For; only set this
|
|
56
|
+
# if the app is reachable exclusively through them, else IPs can be spoofed
|
|
57
|
+
PROXY_FIX_X_FOR = 0
|
|
55
58
|
CORS_EXPOSE_HEADERS = ["X-Total-Count"]
|
|
56
59
|
STATIC_PATH = "static"
|
|
57
60
|
REQUEST_CACHE_CONFIG = {
|
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
|
|
22
22
|
import unittest
|
|
23
23
|
from io import BytesIO
|
|
24
|
+
from unittest.mock import patch
|
|
24
25
|
|
|
25
26
|
from PIL import Image
|
|
26
27
|
|
|
28
|
+
from gramps_webapi.api.cache import thumbnail_cache
|
|
27
29
|
from gramps_webapi.const import MIME_AVIF
|
|
28
30
|
|
|
29
31
|
from . import BASE_URL, get_test_client
|
|
@@ -440,3 +442,17 @@ class TestFaceDetection(unittest.TestCase):
|
|
|
440
442
|
assert 67 < x2 < 90
|
|
441
443
|
assert 0 <= y1 < 15
|
|
442
444
|
assert 57 < y2 < 90
|
|
445
|
+
|
|
446
|
+
def test_error_not_cached(self):
|
|
447
|
+
"""An error response is not served from the cache once its cause is
|
|
448
|
+
gone, e.g. OpenCV that was installed after the error."""
|
|
449
|
+
with self.client.application.app_context():
|
|
450
|
+
thumbnail_cache.clear()
|
|
451
|
+
path = f"{TEST_URL}F8JYGQFL2PKLSYH79X/face_detection"
|
|
452
|
+
headers = fetch_header(self.client)
|
|
453
|
+
with patch("gramps_webapi.api.file.detect_faces", side_effect=ImportError):
|
|
454
|
+
rv = self.client.get(path, headers=headers)
|
|
455
|
+
self.assertEqual(rv.status_code, 501)
|
|
456
|
+
rv = self.client.get(path, headers=headers)
|
|
457
|
+
self.assertEqual(rv.status_code, 200)
|
|
458
|
+
self.assertEqual(len(rv.json), 1)
|
|
@@ -31,6 +31,7 @@ import unittest
|
|
|
31
31
|
from unittest.mock import patch
|
|
32
32
|
|
|
33
33
|
import gramps.gen.filters.rules.person as person_rules
|
|
34
|
+
from gramps.gen.db.generic import DbGeneric
|
|
34
35
|
from gramps.gen.filters.rules import Rule
|
|
35
36
|
from gramps.gen.plug import BasePluginManager
|
|
36
37
|
from gramps.gen.utils.grampslocale import GrampsLocale
|
|
@@ -1327,6 +1328,57 @@ class TestMatchesQuery(unittest.TestCase):
|
|
|
1327
1328
|
assert self.secret_name_handle in handles
|
|
1328
1329
|
assert self.private_handle not in handles
|
|
1329
1330
|
|
|
1331
|
+
def test_list_loads_only_matching_objects(self):
|
|
1332
|
+
"""A list filtered in SQL loads no other object."""
|
|
1333
|
+
loaded = []
|
|
1334
|
+
get_event_from_handle = DbGeneric.get_event_from_handle
|
|
1335
|
+
|
|
1336
|
+
def get_event(db, handle):
|
|
1337
|
+
loaded.append(handle)
|
|
1338
|
+
return get_event_from_handle(db, handle)
|
|
1339
|
+
|
|
1340
|
+
def iter_events(db):
|
|
1341
|
+
raise AssertionError("all events loaded")
|
|
1342
|
+
|
|
1343
|
+
with (
|
|
1344
|
+
patch.object(DbGeneric, "get_event_from_handle", get_event),
|
|
1345
|
+
patch.object(DbGeneric, "iter_events", iter_events),
|
|
1346
|
+
):
|
|
1347
|
+
status, handles = self._query(
|
|
1348
|
+
"/api/events/", self._rule(f"description == '{self.description}'")
|
|
1349
|
+
)
|
|
1350
|
+
assert status == 200
|
|
1351
|
+
assert handles == {self.event_handle}
|
|
1352
|
+
assert set(loaded) == {self.event_handle}
|
|
1353
|
+
|
|
1354
|
+
def test_list_sorted_and_counted_after_filter(self):
|
|
1355
|
+
"""A filtered list is sorted and paged as before."""
|
|
1356
|
+
headers = fetch_header(self.client)
|
|
1357
|
+
rules = json.dumps(self._rule("date.dateval[1] == 10"))
|
|
1358
|
+
rv = self.client.get(
|
|
1359
|
+
"/api/events/",
|
|
1360
|
+
query_string={"rules": rules, "keys": "gramps_id"},
|
|
1361
|
+
headers=headers,
|
|
1362
|
+
)
|
|
1363
|
+
assert rv.status_code == 200
|
|
1364
|
+
ids = [obj["gramps_id"] for obj in rv.json]
|
|
1365
|
+
assert len(ids) > 10
|
|
1366
|
+
assert ids == sorted(ids)
|
|
1367
|
+
rv = self.client.get(
|
|
1368
|
+
"/api/events/",
|
|
1369
|
+
query_string={
|
|
1370
|
+
"rules": rules,
|
|
1371
|
+
"keys": "gramps_id",
|
|
1372
|
+
"sort": "-gramps_id",
|
|
1373
|
+
"page": 2,
|
|
1374
|
+
"pagesize": 5,
|
|
1375
|
+
},
|
|
1376
|
+
headers=headers,
|
|
1377
|
+
)
|
|
1378
|
+
assert rv.status_code == 200
|
|
1379
|
+
assert rv.headers["X-Total-Count"] == str(len(ids))
|
|
1380
|
+
assert [obj["gramps_id"] for obj in rv.json] == ids[::-1][5:10]
|
|
1381
|
+
|
|
1330
1382
|
def test_invalid_expression_returns_422(self):
|
|
1331
1383
|
"""Unparsable expressions and unknown fields return 422."""
|
|
1332
1384
|
for expression in ["gramps_id ==", "not_a_field == 1", ""]:
|
|
@@ -681,18 +681,58 @@ class TestOIDCMultiTree(unittest.TestCase):
|
|
|
681
681
|
"gramps_webapi.api.resources.oidc.get_available_oidc_providers",
|
|
682
682
|
return_value=["custom"],
|
|
683
683
|
)
|
|
684
|
-
|
|
685
|
-
|
|
684
|
+
@patch("gramps_webapi.api.resources.oidc.create_or_update_oidc_user")
|
|
685
|
+
@patch("gramps_webapi.api.resources.oidc.get_name", return_value="testuser")
|
|
686
|
+
@patch(
|
|
687
|
+
"gramps_webapi.api.resources.oidc.get_tree_id_and_permissions",
|
|
688
|
+
return_value=("users_tree", {"EditObject"}),
|
|
689
|
+
)
|
|
690
|
+
@patch("gramps_webapi.api.resources.oidc.get_tokens")
|
|
691
|
+
def test_login_without_tree(
|
|
692
|
+
self,
|
|
693
|
+
mock_get_tokens,
|
|
694
|
+
mock_tree_and_perms,
|
|
695
|
+
mock_get_name,
|
|
696
|
+
mock_create_user,
|
|
697
|
+
mock_providers,
|
|
698
|
+
mock_oidc_enabled,
|
|
699
|
+
):
|
|
700
|
+
"""A login without a tree reaches the provider and the callback.
|
|
701
|
+
|
|
702
|
+
The login page does not know the tree in a multi-tree setup, so this is
|
|
703
|
+
how a user with a linked identity logs in: the account's own tree is
|
|
704
|
+
used. Regression test for gramps-project/gramps-web#1661.
|
|
705
|
+
"""
|
|
686
706
|
mock_oauth = MagicMock()
|
|
687
|
-
|
|
707
|
+
mock_oidc_client = MagicMock()
|
|
708
|
+
mock_oauth.gramps_custom = mock_oidc_client
|
|
709
|
+
mock_oidc_client.authorize_redirect.return_value = redirect(
|
|
710
|
+
"https://idp.example.com/authorize"
|
|
711
|
+
)
|
|
712
|
+
mock_oidc_client.authorize_access_token.return_value = {
|
|
713
|
+
"access_token": "test_token"
|
|
714
|
+
}
|
|
715
|
+
mock_oidc_client.userinfo.return_value = {"sub": "user123"}
|
|
716
|
+
mock_create_user.return_value = "user-guid-123"
|
|
717
|
+
mock_get_tokens.return_value = {
|
|
718
|
+
"access_token": "jwt_access_token",
|
|
719
|
+
"refresh_token": "jwt_refresh_token",
|
|
720
|
+
}
|
|
721
|
+
|
|
688
722
|
with patch.dict(
|
|
689
723
|
self.client.application.extensions,
|
|
690
724
|
{"authlib.integrations.flask_client": mock_oauth},
|
|
691
725
|
clear=False,
|
|
692
726
|
):
|
|
693
727
|
rv = self.client.get(BASE_URL + "/oidc/login/?provider=custom")
|
|
694
|
-
|
|
695
|
-
|
|
728
|
+
self.assertEqual(rv.status_code, 302)
|
|
729
|
+
rv = self.client.get(BASE_URL + "/oidc/callback/custom?code=auth_code")
|
|
730
|
+
|
|
731
|
+
self.assertEqual(rv.status_code, 302)
|
|
732
|
+
self.assertIn("/oidc/complete", rv.location)
|
|
733
|
+
# no tree is handed on, so the account's stored tree applies
|
|
734
|
+
self.assertIsNone(mock_create_user.call_args[0][1])
|
|
735
|
+
self.assertEqual(mock_get_tokens.call_args[1]["tree_id"], "users_tree")
|
|
696
736
|
|
|
697
737
|
@patch("gramps_webapi.api.resources.oidc.is_oidc_enabled", return_value=True)
|
|
698
738
|
@patch(
|
|
@@ -789,8 +829,21 @@ class TestOIDCMultiTree(unittest.TestCase):
|
|
|
789
829
|
"gramps_webapi.api.resources.oidc.get_available_oidc_providers",
|
|
790
830
|
return_value=["custom"],
|
|
791
831
|
)
|
|
792
|
-
|
|
793
|
-
"
|
|
832
|
+
@patch(
|
|
833
|
+
"gramps_webapi.auth.oidc.get_provider_config",
|
|
834
|
+
return_value={"username_claim": "preferred_username"},
|
|
835
|
+
)
|
|
836
|
+
@patch("gramps_webapi.auth.oidc.get_oidc_account", return_value=None)
|
|
837
|
+
@patch("gramps_webapi.auth.oidc.add_user")
|
|
838
|
+
def test_new_identity_without_tree_is_refused(
|
|
839
|
+
self,
|
|
840
|
+
mock_add_user,
|
|
841
|
+
mock_get_oidc_account,
|
|
842
|
+
mock_get_provider_config,
|
|
843
|
+
mock_providers,
|
|
844
|
+
mock_oidc_enabled,
|
|
845
|
+
):
|
|
846
|
+
"""An unknown identity without a tree must not get a treeless account."""
|
|
794
847
|
mock_oauth = MagicMock()
|
|
795
848
|
mock_oidc_client = MagicMock()
|
|
796
849
|
mock_oauth.gramps_custom = mock_oidc_client
|
|
@@ -803,7 +856,9 @@ class TestOIDCMultiTree(unittest.TestCase):
|
|
|
803
856
|
clear=False,
|
|
804
857
|
):
|
|
805
858
|
rv = self.client.get(BASE_URL + "/oidc/callback/custom?code=auth_code")
|
|
806
|
-
self.assertEqual(rv.status_code,
|
|
859
|
+
self.assertEqual(rv.status_code, 400)
|
|
860
|
+
self.assertIn("registration link", rv.get_json()["error"]["message"])
|
|
861
|
+
mock_add_user.assert_not_called()
|
|
807
862
|
|
|
808
863
|
|
|
809
864
|
class TestOIDCSingleTree(unittest.TestCase):
|
|
@@ -202,6 +202,31 @@ class TestTransactionResource(unittest.TestCase):
|
|
|
202
202
|
"/api/transactions/?undo=1&background=1", json=trans_dict, headers=headers
|
|
203
203
|
)
|
|
204
204
|
|
|
205
|
+
def test_conflict_is_rejected_in_background(self):
|
|
206
|
+
"""A changed object rejects the transaction as a client error.
|
|
207
|
+
|
|
208
|
+
The background task must report the same 400 as the synchronous path
|
|
209
|
+
rather than failing like a fault.
|
|
210
|
+
"""
|
|
211
|
+
handle = make_handle()
|
|
212
|
+
obj = {
|
|
213
|
+
"_class": "Note",
|
|
214
|
+
"handle": handle,
|
|
215
|
+
"text": {"_class": "StyledText", "string": "Conflicting note."},
|
|
216
|
+
"gramps_id": "N41",
|
|
217
|
+
}
|
|
218
|
+
trans = [
|
|
219
|
+
{"type": "add", "_class": "Note", "handle": handle, "old": None, "new": obj}
|
|
220
|
+
]
|
|
221
|
+
headers = get_headers(self.client, "editor", "123")
|
|
222
|
+
rv = self.client.post("/api/transactions/", json=trans, headers=headers)
|
|
223
|
+
self.assertEqual(rv.status_code, 200)
|
|
224
|
+
# adding the same object again conflicts with the existing one
|
|
225
|
+
for url in ["/api/transactions/", "/api/transactions/?background=1"]:
|
|
226
|
+
rv = self.client.post(url, json=trans, headers=headers)
|
|
227
|
+
self.assertEqual(rv.status_code, 400, url)
|
|
228
|
+
self.assertEqual(rv.json["error"]["message"], "Object has changed")
|
|
229
|
+
|
|
205
230
|
def test_family_undo(self):
|
|
206
231
|
"""Undo update and subequent deletion of a single note."""
|
|
207
232
|
father = {
|
|
@@ -382,7 +407,7 @@ class TestTransactionResource(unittest.TestCase):
|
|
|
382
407
|
rv = self.client.post(
|
|
383
408
|
"/api/transactions/?background=1", json=trans, headers=headers
|
|
384
409
|
)
|
|
385
|
-
self.assertEqual(rv.status_code,
|
|
410
|
+
self.assertEqual(rv.status_code, 400)
|
|
386
411
|
|
|
387
412
|
def test_missing_gramps_id(self):
|
|
388
413
|
"""Add with missing gramps ID."""
|
|
@@ -400,7 +425,7 @@ class TestTransactionResource(unittest.TestCase):
|
|
|
400
425
|
rv = self.client.post(
|
|
401
426
|
"/api/transactions/?background=1", json=trans, headers=headers
|
|
402
427
|
)
|
|
403
|
-
self.assertEqual(rv.status_code,
|
|
428
|
+
self.assertEqual(rv.status_code, 400)
|
|
404
429
|
|
|
405
430
|
def test_background_returns_task_object(self):
|
|
406
431
|
"""When Celery is active, POST /transactions/?background=1 must return
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
"""Tests for file handling utilities."""
|
|
21
21
|
|
|
22
|
+
import tempfile
|
|
22
23
|
from io import BytesIO
|
|
23
24
|
|
|
24
25
|
import pytest
|
|
@@ -40,6 +41,20 @@ def test_upload_file_local(base_dir):
|
|
|
40
41
|
assert (base_dir / "sub" / "dir" / "file.txt").read_bytes() == b"content"
|
|
41
42
|
|
|
42
43
|
|
|
44
|
+
def test_upload_file_local_spooled_rolled_over(base_dir):
|
|
45
|
+
"""A spooled temporary file that spilled to disk is written (#1165).
|
|
46
|
+
|
|
47
|
+
Once rolled over, the file's ``name`` is an int file descriptor.
|
|
48
|
+
"""
|
|
49
|
+
content = b"x" * 100
|
|
50
|
+
with tempfile.SpooledTemporaryFile(max_size=10) as fp:
|
|
51
|
+
fp.write(content)
|
|
52
|
+
fp.seek(0)
|
|
53
|
+
assert isinstance(fp.name, int)
|
|
54
|
+
upload_file_local(base_dir, "file.bin", fp)
|
|
55
|
+
assert (base_dir / "file.bin").read_bytes() == content
|
|
56
|
+
|
|
57
|
+
|
|
43
58
|
@pytest.mark.parametrize("rel_path", ["../escaped.txt", "sub/../../escaped.txt"])
|
|
44
59
|
def test_upload_file_local_traversal(base_dir, rel_path):
|
|
45
60
|
"""Relative paths escaping the base directory are rejected without writing."""
|
|
@@ -668,6 +668,30 @@ class TestImportErrorReported(unittest.TestCase):
|
|
|
668
668
|
if os.path.exists(temp_file):
|
|
669
669
|
os.unlink(temp_file)
|
|
670
670
|
|
|
671
|
+
def test_invalid_gramps_xml_returns_422(self):
|
|
672
|
+
"""A file the importer cannot read is a client error, not a 500."""
|
|
673
|
+
# XML declaration not at the start of the file
|
|
674
|
+
content = (
|
|
675
|
+
b'\n<?xml version="1.0" encoding="UTF-8"?>\n'
|
|
676
|
+
b'<database xmlns="http://gramps-project.org/xml/1.7.1/"></database>\n'
|
|
677
|
+
)
|
|
678
|
+
with tempfile.NamedTemporaryFile(suffix=".gramps", delete=False) as f:
|
|
679
|
+
f.write(content)
|
|
680
|
+
temp_file = f.name
|
|
681
|
+
try:
|
|
682
|
+
with APP.app_context():
|
|
683
|
+
with self.assertRaises(HTTPException) as context:
|
|
684
|
+
dry_run_import(file_name=temp_file, extension="gramps")
|
|
685
|
+
self.assertEqual(context.exception.code, 422)
|
|
686
|
+
response = context.exception.response
|
|
687
|
+
assert response is not None
|
|
688
|
+
message = response.get_json()["error"]["message"]
|
|
689
|
+
self.assertIn("Import failed", message)
|
|
690
|
+
self.assertIn("XML or text declaration", message)
|
|
691
|
+
finally:
|
|
692
|
+
if os.path.exists(temp_file):
|
|
693
|
+
os.unlink(temp_file)
|
|
694
|
+
|
|
671
695
|
def test_recoverable_error_does_not_fail_import(self):
|
|
672
696
|
"""An error the importer recovered from is reported, not raised."""
|
|
673
697
|
content = (
|
|
@@ -41,6 +41,7 @@ from gramps_webapi.auth.oidc import (
|
|
|
41
41
|
get_usable_email,
|
|
42
42
|
init_oidc,
|
|
43
43
|
)
|
|
44
|
+
from gramps_webapi.const import TREE_MULTI
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
class TestGetUsableEmail:
|
|
@@ -779,6 +780,58 @@ class TestCreateOrUpdateOidcUser:
|
|
|
779
780
|
with pytest.raises(ValueError, match="not configured"):
|
|
780
781
|
create_or_update_oidc_user(userinfo, None, "invalid_provider")
|
|
781
782
|
|
|
783
|
+
@patch("gramps_webapi.auth.oidc.get_oidc_account")
|
|
784
|
+
@patch("gramps_webapi.auth.oidc.get_name", return_value="testuser")
|
|
785
|
+
@patch("gramps_webapi.auth.oidc.modify_user")
|
|
786
|
+
@patch(
|
|
787
|
+
"gramps_webapi.auth.oidc.get_provider_config",
|
|
788
|
+
return_value={"username_claim": "preferred_username"},
|
|
789
|
+
)
|
|
790
|
+
def test_existing_user_multi_tree_without_tree(
|
|
791
|
+
self, mock_get_config, mock_modify, mock_get_name, mock_get_oidc
|
|
792
|
+
):
|
|
793
|
+
"""A linked identity logs in without a tree, keeping the account's tree."""
|
|
794
|
+
mock_get_oidc.return_value = "existing-user-guid"
|
|
795
|
+
mock_app = MagicMock()
|
|
796
|
+
mock_app.config = {"TREE": TREE_MULTI}
|
|
797
|
+
|
|
798
|
+
with (
|
|
799
|
+
patch("gramps_webapi.auth.oidc.current_app", mock_app),
|
|
800
|
+
patch("gramps_webapi.auth.oidc.get_role_from_claims", return_value=None),
|
|
801
|
+
patch(
|
|
802
|
+
"gramps_webapi.api.util.get_tree_id_or_none",
|
|
803
|
+
return_value="users_tree",
|
|
804
|
+
),
|
|
805
|
+
):
|
|
806
|
+
result = create_or_update_oidc_user({"sub": "sub-123"}, None, "google")
|
|
807
|
+
|
|
808
|
+
assert result == "existing-user-guid"
|
|
809
|
+
assert mock_modify.call_args[1]["tree"] is None
|
|
810
|
+
|
|
811
|
+
@patch("gramps_webapi.auth.oidc.get_oidc_account", return_value=None)
|
|
812
|
+
@patch("gramps_webapi.auth.oidc.add_user")
|
|
813
|
+
@patch("gramps_webapi.auth.oidc.create_oidc_account")
|
|
814
|
+
@patch(
|
|
815
|
+
"gramps_webapi.auth.oidc.get_provider_config",
|
|
816
|
+
return_value={"username_claim": "preferred_username"},
|
|
817
|
+
)
|
|
818
|
+
def test_new_user_multi_tree_without_tree(
|
|
819
|
+
self, mock_get_config, mock_create_oidc, mock_add_user, mock_get_oidc
|
|
820
|
+
):
|
|
821
|
+
"""No account is created without a tree in a multi-tree setup."""
|
|
822
|
+
mock_app = MagicMock()
|
|
823
|
+
mock_app.config = {"TREE": TREE_MULTI}
|
|
824
|
+
|
|
825
|
+
with (
|
|
826
|
+
patch("gramps_webapi.auth.oidc.current_app", mock_app),
|
|
827
|
+
patch("gramps_webapi.auth.oidc.get_role_from_claims", return_value=None),
|
|
828
|
+
):
|
|
829
|
+
with pytest.raises(ValueError, match="registration link"):
|
|
830
|
+
create_or_update_oidc_user({"sub": "sub-123"}, None, "google")
|
|
831
|
+
|
|
832
|
+
mock_add_user.assert_not_called()
|
|
833
|
+
mock_create_oidc.assert_not_called()
|
|
834
|
+
|
|
782
835
|
|
|
783
836
|
class TestInitOidc:
|
|
784
837
|
"""Test cases for init_oidc function."""
|