oarepo-runtime 1.5.126__tar.gz → 1.5.128__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.
- {oarepo_runtime-1.5.126/oarepo_runtime.egg-info → oarepo_runtime-1.5.128}/PKG-INFO +1 -1
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/permissions/base.py +2 -1
- oarepo_runtime-1.5.128/oarepo_runtime/records/drafts.py +42 -0
- oarepo_runtime-1.5.128/oarepo_runtime/records/mappings/rdm_parent_mapping.json +483 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/config/__init__.py +4 -0
- oarepo_runtime-1.5.128/oarepo_runtime/services/config/draft_link.py +23 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/config/link_conditions.py +19 -1
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/ui.py +15 -7
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/validation.py +9 -5
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128/oarepo_runtime.egg-info}/PKG-INFO +1 -1
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime.egg-info/SOURCES.txt +2 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/setup.cfg +1 -1
- oarepo_runtime-1.5.126/oarepo_runtime/records/mappings/rdm_parent_mapping.json +0 -39
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/LICENSE +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/MANIFEST.in +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/README.md +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/assets.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/base.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/cf.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/check.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/configuration.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/fixtures.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/index.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/permissions/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/permissions/evaluate.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/permissions/list.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/permissions/search.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/cli/validate.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/asynchronous.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/catalogue.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/datastreams.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/errors.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/ext.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/fixtures.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/json.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/readers/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/readers/attachments.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/readers/excel.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/readers/json.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/readers/service.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/readers/yaml.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/semi_asynchronous.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/synchronous.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/transformers.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/types.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/utils.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/writers/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/writers/attachments_file.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/writers/attachments_service.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/writers/publish.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/writers/service.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/writers/utils.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/writers/validation_errors.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/datastreams/writers/yaml.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/ext.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/ext_config.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/i18n/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/info/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/info/check.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/info/permissions/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/info/permissions/debug.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/info/views.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/profile.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/proxies.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/dumpers/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/dumpers/edtf_interval.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/dumpers/multilingual_dumper.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/entity_resolvers/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/entity_resolvers/proxies.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/mappings/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/owners/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/owners/registry.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/relations/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/relations/base.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/relations/internal.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/relations/lookup.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/relations/pid_relation.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/featured_file.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/has_draftcheck.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/icu.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/mapping.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/owner.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/record_status.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/selectors.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/records/systemfields/synthetic.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/resources/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/resources/config.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/resources/file_resource.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/resources/json_serializer.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/resources/localized_ui_json_serializer.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/resources/resource.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/resources/responses.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/components.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/config/permissions_presets.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/config/service.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/custom_fields/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/custom_fields/mappings.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/entity/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/entity/config.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/entity/schema.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/entity/service.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/expansions/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/expansions/expandable_fields.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/expansions/service.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/base.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/date.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/enum.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/facet_groups_names.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/max_facet.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/nested_facet.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/params.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/facets/year_histogram.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/files/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/files/components.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/files/service.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/generators.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/permissions/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/permissions/generators.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/records/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/records/links.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/relations/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/relations/components.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/relations/errors.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/relations/mapping.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/results.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/cf.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/i18n.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/i18n_ui.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/i18n_validation.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/marshmallow.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/marshmallow_to_json_schema.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/oneofschema.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/polymorphic.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/rdm.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/schema/rdm_ui.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/search.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/service.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/tasks.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/translations/default_translations.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/translations/en/LC_MESSAGES/messages.mo +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/translations/en/LC_MESSAGES/messages.po +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/translations/messages.pot +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/uow.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/utils/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/utils/functools.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/utils/path.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime.egg-info/dependency_links.txt +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime.egg-info/entry_points.txt +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime.egg-info/requires.txt +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime.egg-info/top_level.txt +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/pyproject.toml +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/setup.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/tests/marshmallow_to_json/__init__.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/tests/marshmallow_to_json/test_datacite_ui_schema.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/tests/marshmallow_to_json/test_simple_schema.py +0 -0
- {oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/tests/pkg_data/__init__.py +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
from flask import current_app
|
2
|
-
from flask_principal import Identity, identity_loaded
|
2
|
+
from flask_principal import Identity, UserNeed, identity_loaded
|
3
3
|
from invenio_access.models import User
|
4
4
|
|
5
5
|
from ..base import oarepo
|
@@ -18,6 +18,7 @@ def get_user_and_identity(user_id_or_email):
|
|
18
18
|
user = User.query.filter_by(email=user_id_or_email).one()
|
19
19
|
|
20
20
|
identity = Identity(user.id)
|
21
|
+
identity.provides.add(UserNeed(str(user.id)))
|
21
22
|
api_app = current_app.wsgi_app.mounts["/api"]
|
22
23
|
with api_app.app_context():
|
23
24
|
with current_app.test_request_context("/api"):
|
@@ -0,0 +1,42 @@
|
|
1
|
+
from invenio_records_resources.records.api import Record
|
2
|
+
|
3
|
+
from oarepo_runtime.datastreams.utils import get_record_service_for_record
|
4
|
+
|
5
|
+
|
6
|
+
def has_draft(record: Record) -> bool:
|
7
|
+
return get_draft(record) is not None
|
8
|
+
|
9
|
+
|
10
|
+
def get_draft(record: Record) -> Record | None:
|
11
|
+
"""Get the draft of a published record, if it exists.
|
12
|
+
|
13
|
+
A record can have a draft if:
|
14
|
+
|
15
|
+
- it has a parent record (so, for vocabulary records, this will always be False)
|
16
|
+
- if it has a has_draft attribute (that means, it is a published record)
|
17
|
+
- the has_draft is True meaning that the record has a draft ('edit metadata' button)
|
18
|
+
- if the record has a parent and the parent has a draft (edited 'new version' of the record)
|
19
|
+
"""
|
20
|
+
if getattr(record, "is_draft", False):
|
21
|
+
return record
|
22
|
+
if not hasattr(record, "parent"):
|
23
|
+
return None
|
24
|
+
if not hasattr(record, "has_draft"):
|
25
|
+
return None
|
26
|
+
|
27
|
+
record_service = get_record_service_for_record(record)
|
28
|
+
if not record_service:
|
29
|
+
return None
|
30
|
+
|
31
|
+
try:
|
32
|
+
# if there is no record service, we cannot check for draft
|
33
|
+
if not record_service:
|
34
|
+
return None
|
35
|
+
return next(
|
36
|
+
record_service.config.draft_cls.get_records_by_parent(
|
37
|
+
record.parent, with_deleted=False
|
38
|
+
)
|
39
|
+
)
|
40
|
+
except StopIteration:
|
41
|
+
# no draft found
|
42
|
+
return None
|
@@ -0,0 +1,483 @@
|
|
1
|
+
{
|
2
|
+
"access": {
|
3
|
+
"properties": {
|
4
|
+
"owned_by": {
|
5
|
+
"properties": {
|
6
|
+
"user": {
|
7
|
+
"type": "keyword"
|
8
|
+
}
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"grants": {
|
12
|
+
"properties": {
|
13
|
+
"subject": {
|
14
|
+
"properties": {
|
15
|
+
"type": {
|
16
|
+
"type": "keyword"
|
17
|
+
},
|
18
|
+
"id": {
|
19
|
+
"type": "keyword"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
},
|
23
|
+
"permission": {
|
24
|
+
"type": "keyword"
|
25
|
+
},
|
26
|
+
"origin": {
|
27
|
+
"type": "keyword"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"grant_tokens": {
|
32
|
+
"type": "keyword"
|
33
|
+
},
|
34
|
+
"links": {
|
35
|
+
"properties": {
|
36
|
+
"id": {
|
37
|
+
"type": "keyword"
|
38
|
+
}
|
39
|
+
}
|
40
|
+
},
|
41
|
+
"settings": {
|
42
|
+
"properties": {
|
43
|
+
"allow_user_requests": {
|
44
|
+
"type": "boolean"
|
45
|
+
},
|
46
|
+
"allow_guest_requests": {
|
47
|
+
"type": "boolean"
|
48
|
+
},
|
49
|
+
"accept_conditions_text": {
|
50
|
+
"type": "text"
|
51
|
+
},
|
52
|
+
"secret_link_expiration": {
|
53
|
+
"type": "integer"
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"is_verified": {
|
60
|
+
"type": "boolean"
|
61
|
+
},
|
62
|
+
"communities": {
|
63
|
+
"properties": {
|
64
|
+
"ids": {
|
65
|
+
"type": "keyword"
|
66
|
+
},
|
67
|
+
"default": {
|
68
|
+
"type": "keyword"
|
69
|
+
},
|
70
|
+
"entries": {
|
71
|
+
"type": "object",
|
72
|
+
"properties": {
|
73
|
+
"uuid": {
|
74
|
+
"type": "keyword"
|
75
|
+
},
|
76
|
+
"created": {
|
77
|
+
"type": "date"
|
78
|
+
},
|
79
|
+
"updated": {
|
80
|
+
"type": "date"
|
81
|
+
},
|
82
|
+
"version_id": {
|
83
|
+
"type": "long"
|
84
|
+
},
|
85
|
+
"id": {
|
86
|
+
"type": "keyword"
|
87
|
+
},
|
88
|
+
"is_verified": {
|
89
|
+
"type": "boolean"
|
90
|
+
},
|
91
|
+
"@v": {
|
92
|
+
"type": "keyword"
|
93
|
+
},
|
94
|
+
"slug": {
|
95
|
+
"type": "keyword"
|
96
|
+
},
|
97
|
+
"children": {
|
98
|
+
"properties": {
|
99
|
+
"allow": {
|
100
|
+
"type": "boolean"
|
101
|
+
}
|
102
|
+
}
|
103
|
+
},
|
104
|
+
"metadata": {
|
105
|
+
"properties": {
|
106
|
+
"title": {
|
107
|
+
"type": "text"
|
108
|
+
},
|
109
|
+
"type": {
|
110
|
+
"type": "object",
|
111
|
+
"properties": {
|
112
|
+
"@v": {
|
113
|
+
"type": "keyword"
|
114
|
+
},
|
115
|
+
"id": {
|
116
|
+
"type": "keyword"
|
117
|
+
},
|
118
|
+
"title": {
|
119
|
+
"type": "object",
|
120
|
+
"dynamic": "true",
|
121
|
+
"properties": {
|
122
|
+
"en": {
|
123
|
+
"type": "text"
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
},
|
129
|
+
"organizations": {
|
130
|
+
"type": "object",
|
131
|
+
"properties": {
|
132
|
+
"@v": {
|
133
|
+
"type": "keyword"
|
134
|
+
},
|
135
|
+
"id": {
|
136
|
+
"type": "keyword"
|
137
|
+
},
|
138
|
+
"name": {
|
139
|
+
"type": "text"
|
140
|
+
},
|
141
|
+
"identifiers": {
|
142
|
+
"properties": {
|
143
|
+
"identifier": {
|
144
|
+
"type": "text",
|
145
|
+
"fields": {
|
146
|
+
"keyword": {
|
147
|
+
"type": "keyword"
|
148
|
+
}
|
149
|
+
}
|
150
|
+
},
|
151
|
+
"scheme": {
|
152
|
+
"type": "keyword"
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
},
|
158
|
+
"funding": {
|
159
|
+
"properties": {
|
160
|
+
"award": {
|
161
|
+
"type": "object",
|
162
|
+
"properties": {
|
163
|
+
"@v": {
|
164
|
+
"type": "keyword"
|
165
|
+
},
|
166
|
+
"id": {
|
167
|
+
"type": "keyword"
|
168
|
+
},
|
169
|
+
"title": {
|
170
|
+
"type": "object",
|
171
|
+
"dynamic": "true"
|
172
|
+
},
|
173
|
+
"number": {
|
174
|
+
"type": "text",
|
175
|
+
"fields": {
|
176
|
+
"keyword": {
|
177
|
+
"type": "keyword"
|
178
|
+
}
|
179
|
+
}
|
180
|
+
},
|
181
|
+
"program": {
|
182
|
+
"type": "keyword"
|
183
|
+
},
|
184
|
+
"acronym": {
|
185
|
+
"type": "keyword",
|
186
|
+
"fields": {
|
187
|
+
"text": {
|
188
|
+
"type": "text"
|
189
|
+
}
|
190
|
+
}
|
191
|
+
},
|
192
|
+
"identifiers": {
|
193
|
+
"properties": {
|
194
|
+
"identifier": {
|
195
|
+
"type": "keyword"
|
196
|
+
},
|
197
|
+
"scheme": {
|
198
|
+
"type": "keyword"
|
199
|
+
}
|
200
|
+
}
|
201
|
+
},
|
202
|
+
"subjects": {
|
203
|
+
"properties": {
|
204
|
+
"@v": {
|
205
|
+
"type": "keyword"
|
206
|
+
},
|
207
|
+
"id": {
|
208
|
+
"type": "keyword"
|
209
|
+
},
|
210
|
+
"subject": {
|
211
|
+
"type": "keyword"
|
212
|
+
},
|
213
|
+
"scheme": {
|
214
|
+
"type": "keyword"
|
215
|
+
},
|
216
|
+
"props": {
|
217
|
+
"type": "object",
|
218
|
+
"dynamic": "true"
|
219
|
+
}
|
220
|
+
}
|
221
|
+
},
|
222
|
+
"organizations": {
|
223
|
+
"properties": {
|
224
|
+
"scheme": {
|
225
|
+
"type": "keyword"
|
226
|
+
},
|
227
|
+
"id": {
|
228
|
+
"type": "keyword"
|
229
|
+
},
|
230
|
+
"organization": {
|
231
|
+
"type": "keyword"
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
},
|
237
|
+
"funder": {
|
238
|
+
"type": "object",
|
239
|
+
"properties": {
|
240
|
+
"@v": {
|
241
|
+
"type": "keyword"
|
242
|
+
},
|
243
|
+
"id": {
|
244
|
+
"type": "keyword"
|
245
|
+
},
|
246
|
+
"name": {
|
247
|
+
"type": "text"
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
},
|
253
|
+
"website": {
|
254
|
+
"type": "keyword"
|
255
|
+
}
|
256
|
+
}
|
257
|
+
},
|
258
|
+
"theme": {
|
259
|
+
"type": "object",
|
260
|
+
"properties": {
|
261
|
+
"enabled": {
|
262
|
+
"type": "boolean"
|
263
|
+
},
|
264
|
+
"brand": {
|
265
|
+
"type": "keyword"
|
266
|
+
},
|
267
|
+
"style": {
|
268
|
+
"type": "object",
|
269
|
+
"enabled": false
|
270
|
+
}
|
271
|
+
}
|
272
|
+
},
|
273
|
+
"parent": {
|
274
|
+
"type": "object",
|
275
|
+
"properties": {
|
276
|
+
"uuid": {
|
277
|
+
"type": "keyword"
|
278
|
+
},
|
279
|
+
"created": {
|
280
|
+
"type": "date"
|
281
|
+
},
|
282
|
+
"updated": {
|
283
|
+
"type": "date"
|
284
|
+
},
|
285
|
+
"version_id": {
|
286
|
+
"type": "long"
|
287
|
+
},
|
288
|
+
"id": {
|
289
|
+
"type": "keyword"
|
290
|
+
},
|
291
|
+
"@v": {
|
292
|
+
"type": "keyword"
|
293
|
+
},
|
294
|
+
"is_verified": {
|
295
|
+
"type": "boolean"
|
296
|
+
},
|
297
|
+
"slug": {
|
298
|
+
"type": "keyword"
|
299
|
+
},
|
300
|
+
"children": {
|
301
|
+
"properties": {
|
302
|
+
"allow": {
|
303
|
+
"type": "boolean"
|
304
|
+
}
|
305
|
+
}
|
306
|
+
},
|
307
|
+
"metadata": {
|
308
|
+
"type": "object",
|
309
|
+
"properties": {
|
310
|
+
"title": {
|
311
|
+
"type": "text"
|
312
|
+
},
|
313
|
+
"type": {
|
314
|
+
"type": "object",
|
315
|
+
"properties": {
|
316
|
+
"@v": {
|
317
|
+
"type": "keyword"
|
318
|
+
},
|
319
|
+
"id": {
|
320
|
+
"type": "keyword"
|
321
|
+
},
|
322
|
+
"title": {
|
323
|
+
"type": "object",
|
324
|
+
"dynamic": "true",
|
325
|
+
"properties": {
|
326
|
+
"en": {
|
327
|
+
"type": "text"
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
}
|
332
|
+
},
|
333
|
+
"website": {
|
334
|
+
"type": "keyword"
|
335
|
+
},
|
336
|
+
"organizations": {
|
337
|
+
"type": "object",
|
338
|
+
"properties": {
|
339
|
+
"@v": {
|
340
|
+
"type": "keyword"
|
341
|
+
},
|
342
|
+
"id": {
|
343
|
+
"type": "keyword"
|
344
|
+
},
|
345
|
+
"name": {
|
346
|
+
"type": "text"
|
347
|
+
},
|
348
|
+
"identifiers": {
|
349
|
+
"properties": {
|
350
|
+
"identifier": {
|
351
|
+
"type": "text",
|
352
|
+
"fields": {
|
353
|
+
"keyword": {
|
354
|
+
"type": "keyword"
|
355
|
+
}
|
356
|
+
}
|
357
|
+
},
|
358
|
+
"scheme": {
|
359
|
+
"type": "keyword"
|
360
|
+
}
|
361
|
+
}
|
362
|
+
}
|
363
|
+
}
|
364
|
+
},
|
365
|
+
"funding": {
|
366
|
+
"properties": {
|
367
|
+
"award": {
|
368
|
+
"type": "object",
|
369
|
+
"properties": {
|
370
|
+
"@v": {
|
371
|
+
"type": "keyword"
|
372
|
+
},
|
373
|
+
"id": {
|
374
|
+
"type": "keyword"
|
375
|
+
},
|
376
|
+
"title": {
|
377
|
+
"type": "object",
|
378
|
+
"dynamic": "true"
|
379
|
+
},
|
380
|
+
"number": {
|
381
|
+
"type": "text",
|
382
|
+
"fields": {
|
383
|
+
"keyword": {
|
384
|
+
"type": "keyword"
|
385
|
+
}
|
386
|
+
}
|
387
|
+
},
|
388
|
+
"program": {
|
389
|
+
"type": "keyword"
|
390
|
+
},
|
391
|
+
"acronym": {
|
392
|
+
"type": "keyword",
|
393
|
+
"fields": {
|
394
|
+
"text": {
|
395
|
+
"type": "text"
|
396
|
+
}
|
397
|
+
}
|
398
|
+
},
|
399
|
+
"identifiers": {
|
400
|
+
"properties": {
|
401
|
+
"identifier": {
|
402
|
+
"type": "keyword"
|
403
|
+
},
|
404
|
+
"scheme": {
|
405
|
+
"type": "keyword"
|
406
|
+
}
|
407
|
+
}
|
408
|
+
},
|
409
|
+
"subjects": {
|
410
|
+
"properties": {
|
411
|
+
"@v": {
|
412
|
+
"type": "keyword"
|
413
|
+
},
|
414
|
+
"id": {
|
415
|
+
"type": "keyword"
|
416
|
+
},
|
417
|
+
"subject": {
|
418
|
+
"type": "keyword"
|
419
|
+
},
|
420
|
+
"scheme": {
|
421
|
+
"type": "keyword"
|
422
|
+
},
|
423
|
+
"props": {
|
424
|
+
"type": "object",
|
425
|
+
"dynamic": "true"
|
426
|
+
}
|
427
|
+
}
|
428
|
+
},
|
429
|
+
"organizations": {
|
430
|
+
"properties": {
|
431
|
+
"scheme": {
|
432
|
+
"type": "keyword"
|
433
|
+
},
|
434
|
+
"id": {
|
435
|
+
"type": "keyword"
|
436
|
+
},
|
437
|
+
"organization": {
|
438
|
+
"type": "keyword"
|
439
|
+
}
|
440
|
+
}
|
441
|
+
}
|
442
|
+
}
|
443
|
+
},
|
444
|
+
"funder": {
|
445
|
+
"type": "object",
|
446
|
+
"properties": {
|
447
|
+
"@v": {
|
448
|
+
"type": "keyword"
|
449
|
+
},
|
450
|
+
"id": {
|
451
|
+
"type": "keyword"
|
452
|
+
},
|
453
|
+
"name": {
|
454
|
+
"type": "text"
|
455
|
+
}
|
456
|
+
}
|
457
|
+
}
|
458
|
+
}
|
459
|
+
}
|
460
|
+
}
|
461
|
+
},
|
462
|
+
"theme": {
|
463
|
+
"type": "object",
|
464
|
+
"properties": {
|
465
|
+
"enabled": {
|
466
|
+
"type": "boolean"
|
467
|
+
},
|
468
|
+
"brand": {
|
469
|
+
"type": "keyword"
|
470
|
+
},
|
471
|
+
"style": {
|
472
|
+
"type": "object",
|
473
|
+
"enabled": false
|
474
|
+
}
|
475
|
+
}
|
476
|
+
}
|
477
|
+
}
|
478
|
+
}
|
479
|
+
}
|
480
|
+
}
|
481
|
+
}
|
482
|
+
}
|
483
|
+
}
|
{oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/config/__init__.py
RENAMED
@@ -1,5 +1,7 @@
|
|
1
|
+
from .draft_link import DraftLink
|
1
2
|
from .link_conditions import (
|
2
3
|
has_draft,
|
4
|
+
has_draft_permission,
|
3
5
|
has_file_permission,
|
4
6
|
has_permission,
|
5
7
|
has_permission_file_service,
|
@@ -28,4 +30,6 @@ __all__ = (
|
|
28
30
|
"has_permission_file_service",
|
29
31
|
"has_file_permission",
|
30
32
|
"has_published_record",
|
33
|
+
"has_draft_permission",
|
34
|
+
"DraftLink",
|
31
35
|
)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
from invenio_records_resources.services import RecordLink
|
2
|
+
|
3
|
+
from oarepo_runtime.records.drafts import get_draft
|
4
|
+
|
5
|
+
|
6
|
+
class DraftLink(RecordLink):
|
7
|
+
"""Draft link."""
|
8
|
+
|
9
|
+
def __init__(self, *args, **kwargs):
|
10
|
+
"""Initialize draft link."""
|
11
|
+
super().__init__(*args, **kwargs)
|
12
|
+
|
13
|
+
@staticmethod
|
14
|
+
def vars(record, vars):
|
15
|
+
"""Variables for the URI template."""
|
16
|
+
# Some records don't have record.pid.pid_value yet (e.g. drafts)
|
17
|
+
RecordLink.vars(record, vars)
|
18
|
+
draft_record = get_draft(record)
|
19
|
+
|
20
|
+
if draft_record:
|
21
|
+
pid_value = getattr(draft_record.pid, "pid_value", None)
|
22
|
+
if pid_value:
|
23
|
+
vars.update({"id": pid_value})
|
{oarepo_runtime-1.5.126 → oarepo_runtime-1.5.128}/oarepo_runtime/services/config/link_conditions.py
RENAMED
@@ -7,10 +7,10 @@ from invenio_records.api import RecordBase
|
|
7
7
|
from invenio_records_resources.records.api import FileRecord, Record
|
8
8
|
|
9
9
|
from ...datastreams.utils import (
|
10
|
-
get_file_service_for_file_record_class,
|
11
10
|
get_file_service_for_record_class,
|
12
11
|
get_record_service_for_record,
|
13
12
|
)
|
13
|
+
from ...records.drafts import get_draft
|
14
14
|
|
15
15
|
log = getLogger(__name__)
|
16
16
|
|
@@ -76,6 +76,24 @@ class has_permission(Condition):
|
|
76
76
|
log.exception(f"Unexpected exception {e}.")
|
77
77
|
|
78
78
|
|
79
|
+
class has_draft_permission(Condition):
|
80
|
+
def __init__(self, action_name):
|
81
|
+
self.action_name = action_name
|
82
|
+
|
83
|
+
def __call__(self, obj: RecordBase, ctx: dict):
|
84
|
+
draft_record = get_draft(obj)
|
85
|
+
if not draft_record:
|
86
|
+
return False
|
87
|
+
service = get_record_service_for_record(obj)
|
88
|
+
try:
|
89
|
+
return service.check_permission(
|
90
|
+
action_name=self.action_name, record=draft_record, **ctx
|
91
|
+
)
|
92
|
+
except Exception as e:
|
93
|
+
log.exception(f"Unexpected exception {e}.")
|
94
|
+
return False
|
95
|
+
|
96
|
+
|
79
97
|
class has_file_permission(has_permission):
|
80
98
|
def __call__(self, obj: RecordBase, ctx: dict):
|
81
99
|
if isinstance(obj, FileRecord):
|
@@ -2,27 +2,29 @@ import datetime
|
|
2
2
|
import re
|
3
3
|
|
4
4
|
import marshmallow as ma
|
5
|
-
from marshmallow.fields import Dict, Nested
|
6
|
-
from marshmallow_utils.fields import SanitizedUnicode
|
7
|
-
from invenio_rdm_records.services.schemas.pids import PIDSchema
|
8
5
|
from babel.dates import format_date
|
9
6
|
from babel_edtf import format_edtf
|
10
7
|
from flask import current_app
|
8
|
+
from idutils import to_url
|
11
9
|
from invenio_rdm_records.records.systemfields.access.field.record import (
|
12
10
|
AccessStatusEnum,
|
13
11
|
)
|
14
12
|
from invenio_rdm_records.resources.serializers.ui.fields import (
|
15
13
|
UIObjectAccessStatus as InvenioUIObjectAccessStatus,
|
16
14
|
)
|
15
|
+
from invenio_rdm_records.services.schemas.parent import RDMParentSchema
|
16
|
+
from invenio_rdm_records.services.schemas.pids import PIDSchema
|
17
|
+
from invenio_rdm_records.services.schemas.record import validate_scheme
|
17
18
|
from invenio_rdm_records.services.schemas.versions import VersionsSchema
|
19
|
+
from marshmallow.fields import Dict, Nested
|
18
20
|
from marshmallow_utils.fields import (
|
19
21
|
BabelGettextDictField,
|
20
22
|
FormatDate,
|
21
23
|
FormatDatetime,
|
22
24
|
FormatEDTF,
|
23
25
|
FormatTime,
|
26
|
+
SanitizedUnicode,
|
24
27
|
)
|
25
|
-
from invenio_rdm_records.services.schemas.parent import RDMParentSchema
|
26
28
|
from marshmallow_utils.fields.babel import BabelFormatField
|
27
29
|
|
28
30
|
from oarepo_runtime.i18n import gettext
|
@@ -30,9 +32,6 @@ from oarepo_runtime.i18n import lazy_gettext as _
|
|
30
32
|
|
31
33
|
from .marshmallow import RDMBaseRecordSchema
|
32
34
|
|
33
|
-
from invenio_rdm_records.services.schemas.record import validate_scheme
|
34
|
-
from idutils import to_url
|
35
|
-
|
36
35
|
|
37
36
|
def current_default_locale():
|
38
37
|
"""Get the Flask app's default locale."""
|
@@ -55,6 +54,15 @@ class LocalizedMixin:
|
|
55
54
|
return self.context["locale"]
|
56
55
|
return current_default_locale()
|
57
56
|
|
57
|
+
def format_value(self, value):
|
58
|
+
"""Format the value, gracefully handling exceptions."""
|
59
|
+
try:
|
60
|
+
return super().format_value(value)
|
61
|
+
except Exception as e:
|
62
|
+
# Handle the exception gracefully
|
63
|
+
current_app.logger.error(f"Error formatting value '{value}': {e}")
|
64
|
+
return f"«Error formatting value '{value}'»"
|
65
|
+
|
58
66
|
|
59
67
|
# localized date field
|
60
68
|
class LocalizedDate(LocalizedMixin, FormatDate):
|