├── webui ├── app │ ├── img │ │ ├── .gitkeep │ │ ├── eu.jpg │ │ ├── logo.png │ │ ├── orcid.png │ │ ├── b2drop.png │ │ ├── b2safe.png │ │ ├── bg-page.jpg │ │ ├── ce-logo.png │ │ ├── flag-ce.jpg │ │ ├── footer.png │ │ ├── header.png │ │ ├── invenio.png │ │ ├── line_35.png │ │ ├── line_36.png │ │ ├── color-line.jpg │ │ ├── eosc-hub-g.png │ │ ├── eosc-hub-w.png │ │ ├── eosc-hub.png │ │ ├── img_header.png │ │ ├── footer-line.png │ │ ├── communities │ │ │ ├── nrm.png │ │ │ ├── rda.png │ │ │ ├── aalto.jpg │ │ │ ├── bbmri.png │ │ │ ├── drihm.png │ │ │ ├── eudat.png │ │ │ ├── euon.png │ │ │ ├── gbif.png │ │ │ ├── lter.jpg │ │ │ ├── clarin.png │ │ │ └── eiscat.png │ │ └── logo_eudat_cdi.png │ ├── favicon.ico │ ├── fonts │ │ ├── Raleway.woff │ │ ├── Raleway.woff2 │ │ ├── Raleway_bold.woff │ │ ├── Raleway_bold.woff2 │ │ ├── Raleway_medium.woff │ │ ├── Raleway_medium.woff2 │ │ ├── Raleway_semibold.woff │ │ ├── Raleway_semibold.woff2 │ │ └── open_sans │ │ │ ├── open-sans-v34-latin-300.eot │ │ │ ├── open-sans-v34-latin-300.ttf │ │ │ ├── open-sans-v34-latin-500.eot │ │ │ ├── open-sans-v34-latin-500.ttf │ │ │ ├── open-sans-v34-latin-600.eot │ │ │ ├── open-sans-v34-latin-600.ttf │ │ │ ├── open-sans-v34-latin-700.eot │ │ │ ├── open-sans-v34-latin-700.ttf │ │ │ ├── open-sans-v34-latin-800.eot │ │ │ ├── open-sans-v34-latin-800.ttf │ │ │ ├── open-sans-v34-latin-300.woff │ │ │ ├── open-sans-v34-latin-300.woff2 │ │ │ ├── open-sans-v34-latin-500.woff │ │ │ ├── open-sans-v34-latin-500.woff2 │ │ │ ├── open-sans-v34-latin-600.woff │ │ │ ├── open-sans-v34-latin-600.woff2 │ │ │ ├── open-sans-v34-latin-700.woff │ │ │ ├── open-sans-v34-latin-700.woff2 │ │ │ ├── open-sans-v34-latin-800.woff │ │ │ ├── open-sans-v34-latin-800.woff2 │ │ │ ├── open-sans-v34-latin-italic.eot │ │ │ ├── open-sans-v34-latin-italic.ttf │ │ │ ├── open-sans-v34-latin-italic.woff │ │ │ ├── open-sans-v34-latin-italic.woff2 │ │ │ ├── open-sans-v34-latin-regular.eot │ │ │ ├── open-sans-v34-latin-regular.ttf │ │ │ ├── open-sans-v34-latin-regular.woff │ │ │ ├── open-sans-v34-latin-300italic.eot │ │ │ ├── open-sans-v34-latin-300italic.ttf │ │ │ ├── open-sans-v34-latin-300italic.woff │ │ │ ├── open-sans-v34-latin-500italic.eot │ │ │ ├── open-sans-v34-latin-500italic.ttf │ │ │ ├── open-sans-v34-latin-500italic.woff │ │ │ ├── open-sans-v34-latin-600italic.eot │ │ │ ├── open-sans-v34-latin-600italic.ttf │ │ │ ├── open-sans-v34-latin-600italic.woff │ │ │ ├── open-sans-v34-latin-700italic.eot │ │ │ ├── open-sans-v34-latin-700italic.ttf │ │ │ ├── open-sans-v34-latin-700italic.woff │ │ │ ├── open-sans-v34-latin-800italic.eot │ │ │ ├── open-sans-v34-latin-800italic.ttf │ │ │ ├── open-sans-v34-latin-800italic.woff │ │ │ ├── open-sans-v34-latin-regular.woff2 │ │ │ ├── open-sans-v34-latin-300italic.woff2 │ │ │ ├── open-sans-v34-latin-500italic.woff2 │ │ │ ├── open-sans-v34-latin-600italic.woff2 │ │ │ ├── open-sans-v34-latin-700italic.woff2 │ │ │ └── open-sans-v34-latin-800italic.woff2 │ ├── matomo-config.js │ └── license-selector.html ├── .babelrc ├── src │ ├── .eslintrc │ ├── components │ │ ├── waiting.jsx │ │ ├── help.jsx │ │ ├── animate.jsx │ │ └── selectlicense.jsx │ ├── documentation.md │ └── __tests__ │ │ ├── common.js │ │ └── homepage.js ├── copy_files.sh ├── webpack.config.devel.js └── package.json ├── b2share ├── modules │ ├── upgrade │ │ ├── upgrades │ │ │ ├── __init__.py │ │ │ ├── upgrade_2_2_1_to_2_2_2.py │ │ │ ├── upgrade_2_2_2_to_2_2_3.py │ │ │ ├── upgrade_2_2_3_to_2_2_4.py │ │ │ ├── upgrade_2_2_5_to_2_3_0.py │ │ │ ├── upgrade_2_3_0_to_2_3_1.py │ │ │ ├── upgrade_2_3_1_to_2_3_2.py │ │ │ ├── upgrade_2_3_2_to_2_3_3.py │ │ │ ├── upgrade_2_3_3_to_2_3_4.py │ │ │ ├── upgrade_2_3_4_to_2_4_0.py │ │ │ ├── upgrade_2_4_0_to_2_4_1.py │ │ │ ├── upgrade_2_4_1_to_2_4_2.py │ │ │ ├── upgrade_2_4_2_to_2_4_3.py │ │ │ ├── upgrade_2_4_3_to_2_4_4.py │ │ │ ├── upgrade_2_2_4_to_2_2_5.py │ │ │ ├── upgrade_2_1_1_to_2_1_2.py │ │ │ ├── upgrade_2_1_2_to_2_1_3.py │ │ │ ├── upgrade_2_1_3_to_2_1_4.py │ │ │ ├── upgrade_2_1_4_to_2_1_5.py │ │ │ ├── upgrade_2_1_5_to_2_1_6.py │ │ │ ├── upgrade_2_1_6_to_2_1_7.py │ │ │ ├── upgrade_2_2_0_to_2_2_1.py │ │ │ └── upgrade_2_1_0_to_2_1_1.py │ │ ├── alembic │ │ │ ├── 53b6e1711607_create_upgrade_branch.py │ │ │ └── 456bf6bcb1e6_create_upgrade_table.py │ │ ├── ext.py │ │ ├── cli.py │ │ └── errors.py │ ├── deposit │ │ ├── search.py │ │ ├── mappings │ │ │ └── __init__.py │ │ ├── utils.py │ │ ├── serializers │ │ │ └── __init__.py │ │ ├── fetchers.py │ │ └── cli.py │ ├── communities │ │ ├── alembic │ │ │ ├── ec77f5a034d1_create_communities_branch.py │ │ │ └── fb99eeaec4ac_create_communities_tables.py │ │ ├── config.py │ │ ├── helpers.py │ │ ├── policies.py │ │ └── ext.py │ ├── schemas │ │ ├── alembic │ │ │ └── 226892354af5_create_schemas_branch.py │ │ └── ext.py │ ├── records │ │ ├── serializers │ │ │ ├── xmlserializer.py │ │ │ └── schemas │ │ │ │ └── __init__.py │ │ ├── mappings │ │ │ └── __init__.py │ │ ├── constants.py │ │ └── loaders.py │ ├── management │ │ ├── __init__.py │ │ └── ownership │ │ │ ├── __init__.py │ │ │ └── ext.py │ ├── configloader │ │ ├── __init__.py │ │ └── utils.py │ ├── handle │ │ ├── proxies.py │ │ ├── __init__.py │ │ └── errors.py │ ├── __init__.py │ ├── apiroot │ │ ├── __init__.py │ │ └── ext.py │ ├── linkset │ │ ├── __init__.py │ │ └── ext.py │ ├── remotes │ │ ├── __init__.py │ │ ├── ext.py │ │ └── errors.py │ ├── stats │ │ ├── __init__.py │ │ ├── processors.py │ │ ├── aggregations.py │ │ ├── registrations.py │ │ ├── ext.py │ │ ├── event_builders.py │ │ ├── record_view │ │ │ └── record-view-v1.json │ │ └── api.py │ ├── oaiserver │ │ ├── ext.py │ │ └── __init__.py │ ├── oauthclient │ │ └── __init__.py │ ├── access │ │ ├── __init__.py │ │ └── ext.py │ ├── files │ │ ├── __init__.py │ │ ├── storage.py │ │ └── ext.py │ ├── roles │ │ ├── __init__.py │ │ ├── cli.py │ │ └── ext.py │ └── users │ │ ├── __init__.py │ │ └── ext.py ├── cli.py ├── version.py ├── wsgi.py ├── celery.py └── __init__.py ├── elasticsearch ├── config │ ├── elasticsearch.yml │ └── logging.yml └── docker-entrypoint.sh ├── run-tests.sh ├── manage.py ├── .dockerignore ├── pytest.ini ├── Procfile ├── demo ├── b2share_demo │ ├── data │ │ ├── communities │ │ │ ├── block_schemas │ │ │ │ └── README.txt │ │ │ ├── eudat.json │ │ │ └── lter.json │ │ └── records │ │ │ ├── clarin │ │ │ └── 1033083F-EDF4-408F-B561-1F23527A926D.json │ │ │ ├── bbmri │ │ │ └── a1c2ef96-a1e4-46fa-9bd7-a2a46d2242d4.json │ │ │ └── rda │ │ │ └── 47077E3C-4B9F-4852-A407-09E338AD4620.json │ ├── __init__.py │ └── ext.py ├── re-import.sh ├── setup.py └── README.rst ├── webui.cfg ├── setup.cfg ├── dockerize ├── uwsgi.ini ├── b2share-celery.sh ├── supervisord.conf └── b2share.sh ├── devenv └── docker-compose.yml ├── .editorconfig ├── docs ├── license.rst ├── authors.rst ├── installation.rst ├── contributing.rst ├── changes.rst └── index.rst ├── .gitignore ├── .travis-release-requirements.txt ├── requirements.in ├── tests ├── b2share_unit_tests │ ├── schemas │ │ └── conftest.py │ ├── communities │ │ └── test_communities_ext.py │ ├── records │ │ └── test_records_utils.py │ ├── b2stats │ │ └── test_b2stats_api.py │ ├── apiroot │ │ └── test_apiroot_rest.py │ └── deposit │ │ └── test_deposit_cli.py ├── data │ └── communities │ │ └── my_test_community2.json └── b2share_functional_tests │ └── conftests.py ├── requirements-devel.txt ├── AUTHORS.rst └── MANIFEST.in /webui/app/img/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webui/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "react"] 3 | } -------------------------------------------------------------------------------- /elasticsearch/config/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | network.host: 0.0.0.0 2 | -------------------------------------------------------------------------------- /run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # -*- coding: utf-8 -*- 3 | python3 setup.py test 4 | -------------------------------------------------------------------------------- /webui/app/img/eu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/eu.jpg -------------------------------------------------------------------------------- /webui/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/favicon.ico -------------------------------------------------------------------------------- /webui/app/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/logo.png -------------------------------------------------------------------------------- /webui/app/img/orcid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/orcid.png -------------------------------------------------------------------------------- /webui/app/img/b2drop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/b2drop.png -------------------------------------------------------------------------------- /webui/app/img/b2safe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/b2safe.png -------------------------------------------------------------------------------- /webui/app/img/bg-page.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/bg-page.jpg -------------------------------------------------------------------------------- /webui/app/img/ce-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/ce-logo.png -------------------------------------------------------------------------------- /webui/app/img/flag-ce.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/flag-ce.jpg -------------------------------------------------------------------------------- /webui/app/img/footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/footer.png -------------------------------------------------------------------------------- /webui/app/img/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/header.png -------------------------------------------------------------------------------- /webui/app/img/invenio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/invenio.png -------------------------------------------------------------------------------- /webui/app/img/line_35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/line_35.png -------------------------------------------------------------------------------- /webui/app/img/line_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/line_36.png -------------------------------------------------------------------------------- /webui/app/fonts/Raleway.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/Raleway.woff -------------------------------------------------------------------------------- /webui/app/img/color-line.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/color-line.jpg -------------------------------------------------------------------------------- /webui/app/img/eosc-hub-g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/eosc-hub-g.png -------------------------------------------------------------------------------- /webui/app/img/eosc-hub-w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/eosc-hub-w.png -------------------------------------------------------------------------------- /webui/app/img/eosc-hub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/eosc-hub.png -------------------------------------------------------------------------------- /webui/app/img/img_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/img_header.png -------------------------------------------------------------------------------- /webui/app/matomo-config.js: -------------------------------------------------------------------------------- 1 | window.B2SHARE_WEBUI_MATOMO_SITEID = '' 2 | window.B2SHARE_WEBUI_MATOMO_URL = '' 3 | -------------------------------------------------------------------------------- /webui/app/fonts/Raleway.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/Raleway.woff2 -------------------------------------------------------------------------------- /webui/app/img/footer-line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/footer-line.png -------------------------------------------------------------------------------- /webui/app/fonts/Raleway_bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/Raleway_bold.woff -------------------------------------------------------------------------------- /webui/app/img/communities/nrm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/nrm.png -------------------------------------------------------------------------------- /webui/app/img/communities/rda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/rda.png -------------------------------------------------------------------------------- /webui/app/img/logo_eudat_cdi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/logo_eudat_cdi.png -------------------------------------------------------------------------------- /webui/app/fonts/Raleway_bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/Raleway_bold.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/Raleway_medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/Raleway_medium.woff -------------------------------------------------------------------------------- /webui/app/img/communities/aalto.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/aalto.jpg -------------------------------------------------------------------------------- /webui/app/img/communities/bbmri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/bbmri.png -------------------------------------------------------------------------------- /webui/app/img/communities/drihm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/drihm.png -------------------------------------------------------------------------------- /webui/app/img/communities/eudat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/eudat.png -------------------------------------------------------------------------------- /webui/app/img/communities/euon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/euon.png -------------------------------------------------------------------------------- /webui/app/img/communities/gbif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/gbif.png -------------------------------------------------------------------------------- /webui/app/img/communities/lter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/lter.jpg -------------------------------------------------------------------------------- /webui/app/fonts/Raleway_medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/Raleway_medium.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/Raleway_semibold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/Raleway_semibold.woff -------------------------------------------------------------------------------- /webui/app/fonts/Raleway_semibold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/Raleway_semibold.woff2 -------------------------------------------------------------------------------- /webui/app/img/communities/clarin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/clarin.png -------------------------------------------------------------------------------- /webui/app/img/communities/eiscat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/img/communities/eiscat.png -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-300.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-300.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-300.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-300.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-500.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-500.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-500.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-500.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-600.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-600.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-600.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-600.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-700.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-700.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-700.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-700.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-800.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-800.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-800.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-800.ttf -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """B2Share management command.""" 4 | 5 | if __name__ == "__main__": 6 | from b2share.cli import cli 7 | cli() 8 | -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-300.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-300.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-300.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-300.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-500.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-500.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-500.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-500.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-600.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-600.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-600.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-600.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-700.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-700.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-800.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-800.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-800.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-800.woff2 -------------------------------------------------------------------------------- /b2share/modules/deposit/search.py: -------------------------------------------------------------------------------- 1 | 2 | from invenio_deposit.search import DepositSearch as DepositRecordSearch 3 | class DepositSearch(DepositRecordSearch): 4 | pass 5 | -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-italic.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-italic.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-italic.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-italic.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-regular.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-regular.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-regular.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-300italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-300italic.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-300italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-300italic.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-300italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-300italic.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-500italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-500italic.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-500italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-500italic.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-500italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-500italic.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-600italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-600italic.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-600italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-600italic.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-600italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-600italic.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-700italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-700italic.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-700italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-700italic.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-700italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-700italic.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-800italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-800italic.eot -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-800italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-800italic.ttf -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-800italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-800italic.woff -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-regular.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-300italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-300italic.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-500italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-500italic.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-600italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-600italic.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-700italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-700italic.woff2 -------------------------------------------------------------------------------- /webui/app/fonts/open_sans/open-sans-v34-latin-800italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EUDAT-B2SHARE/b2share/HEAD/webui/app/fonts/open_sans/open-sans-v34-latin-800italic.woff2 -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | **/*.pyc 3 | .eggs 4 | **/*.swp 5 | **/.DS_Store 6 | **/*.db 7 | **/node_modules 8 | **/b2share-bundle.js* 9 | .vscode 10 | **/docs 11 | *.tar 12 | ci-docker/data 13 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | [pytest] 4 | addopts = --ignore=docs --cov=b2share --cov=demo --cov-report=term-missing 5 | 6 | filterwarnings = 7 | ignore:Update \w* CHECK \w* manually:UserWarning 8 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: inveniomanage runserver 2 | cache: redis-server 3 | worker: celery worker --purge -E -A invenio.celery.celery --loglevel=DEBUG --workdir=$VIRTUAL_ENV 4 | workermon: flower --broker=redis://localhost:6379/1 5 | -------------------------------------------------------------------------------- /demo/b2share_demo/data/communities/block_schemas/README.txt: -------------------------------------------------------------------------------- 1 | This file contains a (specific version of a) Block Schema intended for use with 2 | the b2share schemas add_block_schema_version command . 3 | 4 | It also can serve as a template for other block schema's. -------------------------------------------------------------------------------- /b2share/cli.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """mysite base Invenio configuration.""" 4 | 5 | from __future__ import absolute_import, print_function 6 | 7 | from invenio_base.app import create_cli 8 | 9 | from .factory import create_app 10 | 11 | 12 | cli = create_cli(create_app=create_app) 13 | -------------------------------------------------------------------------------- /demo/re-import.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | b2share db destroy --yes-i-know 4 | b2share index destroy --yes-i-know 5 | b2share db create 6 | b2share index init 7 | b2share schemas init 8 | b2share demo load_config -f 9 | b2share demo load_data 10 | b2share demo import_v1_data -v -d /tmp/b2sharev1 11 | -------------------------------------------------------------------------------- /webui.cfg: -------------------------------------------------------------------------------- 1 | # B2SHARE WebUI configuration variables. 2 | # 3 | # If an environment variable with the same name as any of the keys here 4 | # exist, the value set in environment variable will be used. 5 | # 6 | # Uncomment and give a meaningfull value. 7 | #B2SHARE_WEBUI_MATOMO_URL='localhost:8080' 8 | #B2SHARE_WEBUI_MATOMO_SITEID=1 9 | -------------------------------------------------------------------------------- /webui/src/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parserOptions": { 3 | "sourceType": "module", 4 | "ecmaFeatures": { 5 | "jsx": true, 6 | "modules": true 7 | }, 8 | }, 9 | "env": { 10 | "browser": true, 11 | "node": true, 12 | "es6": true 13 | }, 14 | "rules": { 15 | "strict": 1, 16 | "no-underscore-dangle": 0, 17 | } 18 | } -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | # [build_sphinx] 2 | # source-dir = docs/ 3 | # build-dir = docs/_build 4 | # all_files = 1 5 | 6 | # [aliases] 7 | # build_static = build_npm build_bower build_grunt --path=invenio/base/static/ 8 | # sdist_deploy = build_static sdist 9 | 10 | # [compile_catalog] 11 | # directory = invenio/base/translations/ 12 | 13 | # [bdist_wheel] 14 | # universal = 1 15 | -------------------------------------------------------------------------------- /dockerize/uwsgi.ini: -------------------------------------------------------------------------------- 1 | [uwsgi] 2 | http-socket = 0.0.0.0:5000 3 | master = true 4 | plugin = python36 5 | 6 | processes = 20 7 | buffer-size = 8192 8 | die-on-term = true 9 | vacuum = true 10 | 11 | chdir = /eudat/b2share 12 | wsgi-file = b2share/wsgi.py 13 | pythonpath = /eudat/b2share/b2share:/usr/lib/python3 14 | module = wsgi:application 15 | touch-reload = /eudat/b2share/b2share/wsgi.py 16 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_2_1_to_2_2_2.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.2.1 to 2.2.2.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from ..api import UpgradeRecipe 9 | 10 | 11 | migrate_2_2_1_to_2_2_2 = UpgradeRecipe('2.2.1', '2.2.2') 12 | 13 | # No changes to Elasticsearch mappings 14 | 15 | # There are no changes to the db schema, so no other updates are necessary 16 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_2_2_to_2_2_3.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.2.2 to 2.2.3.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from ..api import UpgradeRecipe 9 | 10 | 11 | migrate_2_2_2_to_2_2_3 = UpgradeRecipe('2.2.2', '2.2.3') 12 | 13 | # No changes to Elasticsearch mappings 14 | 15 | # There are no changes to the db schema, so no other updates are necessary 16 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_2_3_to_2_2_4.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.2.3 to 2.2.4.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from ..api import UpgradeRecipe 9 | 10 | 11 | migrate_2_2_3_to_2_2_4 = UpgradeRecipe('2.2.3', '2.2.4') 12 | 13 | # No changes to Elasticsearch mappings 14 | 15 | # There are no changes to the db schema, so no other updates are necessary 16 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_2_5_to_2_3_0.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.2.5 to 2.3.0.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_2_5_to_2_3_0 = UpgradeRecipe('2.2.5', '2.3.0') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_3_0_to_2_3_1.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.3.0 to 2.3.1.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_3_0_to_2_3_1 = UpgradeRecipe('2.3.0', '2.3.1') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_3_1_to_2_3_2.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.3.1 to 2.3.2.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_3_1_to_2_3_2 = UpgradeRecipe('2.3.1', '2.3.2') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_3_2_to_2_3_3.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.3.2 to 2.3.3.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_3_2_to_2_3_3 = UpgradeRecipe('2.3.2', '2.3.3') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_3_3_to_2_3_4.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.3.3 to 2.3.4.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_3_3_to_2_3_4 = UpgradeRecipe('2.3.3', '2.3.4') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_3_4_to_2_4_0.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.3.4 to 2.4.0""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_3_4_to_2_4_0 = UpgradeRecipe('2.3.4', '2.4.0') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_4_0_to_2_4_1.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.4.0 to 2.4.1""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_4_0_to_2_4_1 = UpgradeRecipe('2.4.0', '2.4.1') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_4_1_to_2_4_2.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.4.1 to 2.4.2""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_4_1_to_2_4_2 = UpgradeRecipe('2.4.1', '2.4.2') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_4_2_to_2_4_3.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.4.2 to 2.4.3""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_4_2_to_2_4_3 = UpgradeRecipe('2.4.2', '2.4.3') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_4_3_to_2_4_4.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.4.3 to 2.4.4""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_4_3_to_2_4_4 = UpgradeRecipe('2.4.3', '2.4.4') 14 | 15 | # There are no ES mapping updates 16 | 17 | # There are no changes to the db schema, so no other updates are necessary 18 | -------------------------------------------------------------------------------- /elasticsearch/config/logging.yml: -------------------------------------------------------------------------------- 1 | # you can override this using by setting a system property, for example -Des.logger.level=DEBUG 2 | es.logger.level: INFO 3 | rootLogger: ${es.logger.level}, console 4 | logger: 5 | # log action execution errors for easier debugging 6 | action: DEBUG 7 | # reduce the logging for aws, too much is logged under the default INFO 8 | com.amazonaws: WARN 9 | 10 | appender: 11 | console: 12 | type: console 13 | layout: 14 | type: consolePattern 15 | conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" 16 | -------------------------------------------------------------------------------- /b2share/modules/communities/alembic/ec77f5a034d1_create_communities_branch.py: -------------------------------------------------------------------------------- 1 | """Create communities branch. 2 | 3 | Revision ID: ec77f5a034d1 4 | Revises: 5 | Create Date: 2017-04-25 17:45:07.928254 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = 'ec77f5a034d1' 14 | down_revision = None 15 | branch_labels = (u'b2share_communities',) 16 | depends_on = 'dbdbc1b19cf2' # in invenio-db 17 | 18 | 19 | def upgrade(): 20 | pass 21 | 22 | 23 | def downgrade(): 24 | pass 25 | -------------------------------------------------------------------------------- /dockerize/b2share-celery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Helper script in order to start separate celery containers, WITH secrets 4 | 5 | sleep 5 6 | 7 | WORKDIR=/eudat/b2share 8 | LOGLEVEL="" 9 | 10 | if [[ "${CELERY_DEBUG}" ]]; then 11 | LOGLEVEL="--loglevel=DEBUG" 12 | fi 13 | 14 | # Start celery if variables are set. 15 | sleep 20 16 | [[ ${CELERY_WORKER} ]] && /usr/local/bin/celery worker -E -A b2share.celery --workdir=${WORKDIR} ${LOGLEVEL} 17 | [[ ${CELERY_BEAT} ]] && /usr/local/bin/celery beat -A b2share.celery --pidfile= --workdir=${WORKDIR} ${LOGLEVEL} 18 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/alembic/53b6e1711607_create_upgrade_branch.py: -------------------------------------------------------------------------------- 1 | """Create upgrade branch. 2 | 3 | Revision ID: 53b6e1711607 4 | Revises: 5 | Create Date: 2017-05-04 11:51:11.157763 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '53b6e1711607' 14 | down_revision = None 15 | branch_labels = () 16 | depends_on = ( 17 | '35c1075e6360', # invenio-db force_naming_convention 18 | ) 19 | 20 | 21 | def upgrade(): 22 | pass 23 | 24 | 25 | def downgrade(): 26 | pass 27 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_2_4_to_2_2_5.py: -------------------------------------------------------------------------------- 1 | """Upgrade recipe migrating B2SHARE from version 2.2.4 to 2.2.5.""" 2 | 3 | 4 | from __future__ import absolute_import, print_function 5 | 6 | import pkg_resources 7 | 8 | from .common import elasticsearch_index_init 9 | 10 | from ..api import UpgradeRecipe 11 | 12 | 13 | migrate_2_2_4_to_2_2_5 = UpgradeRecipe('2.2.4', '2.2.5') 14 | 15 | # Update Elasticsearch mappings 16 | for step in [elasticsearch_index_init]: 17 | migrate_2_2_4_to_2_2_5.step()(step) 18 | 19 | # There are no changes to the db schema, so no other updates are necessary 20 | -------------------------------------------------------------------------------- /b2share/modules/schemas/alembic/226892354af5_create_schemas_branch.py: -------------------------------------------------------------------------------- 1 | """Create schemas branch. 2 | 3 | Revision ID: 226892354af5 4 | Revises: 5 | Create Date: 2017-04-25 18:03:12.388159 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '226892354af5' 14 | down_revision = None 15 | branch_labels = (u'b2share_schemas',) 16 | depends_on = ( 17 | 'dbdbc1b19cf2', # in invenio-db 18 | 'fb99eeaec4ac', # in b2share communities 19 | ) 20 | 21 | 22 | def upgrade(): 23 | pass 24 | 25 | 26 | def downgrade(): 27 | pass 28 | -------------------------------------------------------------------------------- /devenv/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # mysql: 2 | # image: mysql 3 | # ports: 4 | # - "3306:3306" 5 | # environment: 6 | # - MYSQL_ALLOW_EMPTY_PASSWORD=yes 7 | # - MYSQL_USER=b2share_evo 8 | # - MYSQL_DATABASE=b2share_evo 9 | 10 | elasticsearch: 11 | build: ../dockerize/elasticsearch 12 | ports: 13 | - "9200:9200" 14 | - "9300:9300" 15 | 16 | redis: 17 | image: redis 18 | ports: 19 | - "6379:6379" 20 | 21 | mq: 22 | image: rabbitmq:3-management 23 | restart: "always" 24 | ports: 25 | - "15672:15672" 26 | - "5672:5672" 27 | read_only: true 28 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | end_of_line = lf 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | charset = utf-8 9 | 10 | # Python files 11 | [*.py] 12 | indent_size = 4 13 | # isort plugin configuration 14 | known_first_party = invenio 15 | multi_line_output = 2 16 | default_section = THIRDPARTY 17 | 18 | # RST files (used by sphinx) 19 | [*.rst] 20 | indent_size = 4 21 | 22 | # CSS, HTML, JS, JSON, YML 23 | [*.{css,html,js,json,yml}] 24 | indent_size = 2 25 | 26 | # Matches the exact files either package.json or .travis.yml 27 | [{package.json,.travis.yml}] 28 | indent_size = 2 29 | 30 | # Dockerfile 31 | [Dockerfile] 32 | indent_size = 4 33 | -------------------------------------------------------------------------------- /webui/src/components/waiting.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react/lib/ReactWithAddons'; 2 | 3 | 4 | export const Wait = React.createClass({ 5 | render() { 6 | return ( 7 |
Loading...
8 | ); 9 | } 10 | }); 11 | 12 | 13 | export const Err = React.createClass({ 14 | render() { 15 | const error = this.props.err; 16 | let msg = error.text; 17 | if (error.data && error.data.message) { 18 | msg = error.data.message; 19 | } 20 | return ( 21 |
22 |

Error {error.code}

23 | {msg} 24 |
25 | ); 26 | } 27 | }); 28 | -------------------------------------------------------------------------------- /demo/b2share_demo/data/communities/eudat.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "EUDAT", 3 | "description": "The big Eudat community. Use this community if no other is suited for you", 4 | "logo": "/img/communities/eudat.png", 5 | "id": "E9B9792E-79FB-4B07-B6B4-B9C2BD06D095", 6 | "publication_workflow": "direct_publish", 7 | "restricted_submission": false, 8 | "community_schemas": [ 9 | { 10 | "root_schema_version": 0, 11 | "json_schema": { 12 | "$schema": "http://json-schema.org/draft-04/schema#", 13 | "type": "object", 14 | "properties": {}, 15 | "additionalProperties": false 16 | } 17 | } 18 | ], 19 | "block_schemas": { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /demo/b2share_demo/data/records/clarin/1033083F-EDF4-408F-B561-1F23527A926D.json: -------------------------------------------------------------------------------- 1 | { 2 | "titles": [ 3 | {"title":"Časování sloves v bengálštině"} 4 | ], 5 | "descriptions": [ 6 | {"description":"Description of verbal paradigms in Bengali. The description is written in Czech.", 7 | "description_type":"Abstract"} 8 | ], 9 | "creators": [ 10 | {"creator_name":"Daniel Zeman"} 11 | ], 12 | "resource_types": [ 13 | {"resource_type_general": "Text"} 14 | ], 15 | "contact_email": "x@example.com", 16 | "open_access": true, 17 | "community": "$COMMUNITY_ID[CLARIN]", 18 | "community_specific": { 19 | "$BLOCK_SCHEMA_ID[clarin]": { 20 | "language_code": "eng", 21 | "ling_resource_type": ["Text"] 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dockerize/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | logfile = /tmp/supervisord.log 4 | 5 | [program:celery] 6 | command=/usr/local/bin/celery worker -D -E -A b2share.celery -l INFO --workdir=/eudat/b2share 7 | stdout_logfile=/dev/stdout 8 | stdout_logfile_maxbytes=0 9 | stderr_logfile=/dev/stderr 10 | stderr_logfile_maxbytes=0 11 | 12 | [program:celery_beat] 13 | command=/usr/local/bin/celery beat -A b2share.celery -s /tmp/celerybeat-schedule --pidfile= --workdir=/eudat/b2share --loglevel="DEBUG" 14 | stdout_logfile=/dev/stdout 15 | stdout_logfile_maxbytes=0 16 | stderr_logfile=/dev/stderr 17 | stderr_logfile_maxbytes=0 18 | 19 | [program:b2share] 20 | command=uwsgi --ini /eudat/b2share/uwsgi/uwsgi.ini 21 | stdout_logfile=/dev/stdout 22 | stdout_logfile_maxbytes=0 23 | stderr_logfile=/dev/stderr 24 | stderr_logfile_maxbytes=0 25 | -------------------------------------------------------------------------------- /webui/copy_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo Copying files... 3 | 4 | CSS_DIR=app/lib/css 5 | FONTS_DIR=app/lib/fonts 6 | IMG_DIR=app/lib/img 7 | 8 | mkdir -p $CSS_DIR $FONTS_DIR $IMG_DIR 9 | 10 | cp node_modules/bootstrap/dist/css/* $CSS_DIR/ 11 | cp node_modules/bootstrap/dist/fonts/* $FONTS_DIR/ 12 | 13 | cp node_modules/font-awesome/css/* $CSS_DIR/ 14 | cp node_modules/font-awesome/fonts/* $FONTS_DIR/ 15 | 16 | cp node_modules/react-toggle/style.css $CSS_DIR/toggle-style.css 17 | 18 | cp -r node_modules/react-widgets/dist/css/* $CSS_DIR/ 19 | cp -r node_modules/react-widgets/dist/fonts/* $FONTS_DIR/ 20 | cp -r node_modules/react-widgets/dist/img/* $IMG_DIR/ 21 | 22 | # cp node_modules/pluralize/pluralize.js $JS_DIR 23 | # cp node_modules/react/dist/react-with-addons.* $JS_DIR 24 | # cp node_modules/react-dom/dist/react-dom.* $JS_DIR 25 | -------------------------------------------------------------------------------- /b2share/modules/records/serializers/xmlserializer.py: -------------------------------------------------------------------------------- 1 | from invenio_records_rest.serializers.base import PreprocessorMixin 2 | from lxml import etree 3 | from lxml.builder import E 4 | from invenio_records.api import Record 5 | 6 | class XMLSerializer(PreprocessorMixin): 7 | schema_class = None 8 | 9 | def __init__(self, schema, replace_refs=True): 10 | self.schema_class = schema 11 | self.replace_refs = replace_refs 12 | 13 | def serialize_oaipmh(self, pid, record): 14 | rec = None 15 | if isinstance(record, Record): 16 | rec = self.preprocess_record(pid=pid, record=record) 17 | elif isinstance(record['_source'], Record): 18 | rec = self.preprocess_record(pid=pid, record=record['_source']) 19 | else: 20 | rec = self.preprocess_search_hit(pid, record) 21 | return self.schema_class().dump_etree(pid, rec) -------------------------------------------------------------------------------- /elasticsearch/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Add elasticsearch as command if needed 6 | if [ "${1:0:1}" = '-' ]; then 7 | set -- elasticsearch "$@" 8 | fi 9 | 10 | # Drop root privileges if we are running elasticsearch 11 | # allow the container to be started with `--user` 12 | if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then 13 | # Change the ownership of user-mutable directories to elasticsearch 14 | for path in \ 15 | /usr/share/elasticsearch/config \ 16 | /usr/share/elasticsearch/data \ 17 | /usr/share/elasticsearch/logs \ 18 | ; do 19 | chown -R elasticsearch:elasticsearch "$path" 20 | done 21 | 22 | set -- gosu elasticsearch "$@" 23 | #exec gosu elasticsearch "$BASH_SOURCE" "$@" 24 | fi 25 | 26 | # As argument is not related to elasticsearch, 27 | # then assume that user wants to run his own process, 28 | # for example a `bash` shell to explore this image 29 | exec "$@" -------------------------------------------------------------------------------- /docs/license.rst: -------------------------------------------------------------------------------- 1 | License 2 | ======= 3 | B2Share is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU General Public License as 5 | published by the Free Software Foundation; either version 2 of the 6 | License, or (at your option) any later version. 7 | 8 | B2Share is distributed in the hope that it will be useful, but 9 | WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with B2Share; if not, write to the Free Software Foundation, Inc., 15 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 16 | 17 | In applying this license, CERN does not 18 | waive the privileges and immunities granted to it by virtue of its status 19 | as an Intergovernmental Organization or submit itself to any jurisdiction. 20 | -------------------------------------------------------------------------------- /b2share/version.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # Copyright (C) 2015, 2016 CERN. 6 | # 7 | # Invenio Demosite is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # Invenio Demosite is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with Invenio; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """Version number.""" 22 | 23 | 24 | __version__ = "2.4.4" 25 | -------------------------------------------------------------------------------- /demo/b2share_demo/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2Share demonstration.""" 21 | 22 | from __future__ import absolute_import, print_function 23 | 24 | from .ext import B2ShareDemo 25 | 26 | __all__ = ( 27 | 'B2ShareDemo', 28 | ) 29 | -------------------------------------------------------------------------------- /b2share/modules/management/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # This file is part of EUDAT B2Share. 3 | # Copyright (C) 2015 CERN. 4 | # 5 | # Invenio is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # Invenio is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Invenio; if not, write to the Free Software Foundation, Inc., 17 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | r"""EUDAT B2Share Management Module. 20 | 21 | B2SHARE Management Module: (WIP) 22 | 23 | B2SHARE Ownership Managment 24 | 25 | """ 26 | 27 | __all__ = ('EUDAT B2Share Management Module') 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.clisp.mem 2 | *.cmucl.core 3 | *.egg-info 4 | *.fas 5 | *.fasl 6 | *.kdev4 7 | *.kdevelop 8 | *.kdevses 9 | *.lib 10 | *.pyc 11 | *.sbcl.core 12 | *.sse2f 13 | *.x86f 14 | *~ 15 | .DS_Store 16 | .coverage 17 | .eggs 18 | .kdev4/ 19 | .noseids 20 | .project 21 | .pydevproject 22 | .settings 23 | .version 24 | .ropeproject 25 | .idea/ 26 | Invenio.egg-info 27 | Makefile.in 28 | TAGS 29 | bower_components/ 30 | build 31 | compile 32 | dist 33 | docs/_build 34 | docs/db 35 | docs/static 36 | dump.rdb 37 | instance/ 38 | invenio/base/translations/*/LC_MESSAGES/messages.mo 39 | missing 40 | node_modules/ 41 | org.eclipse.core.resources.prefs 42 | tags 43 | install/.vagrant/ 44 | b2share/base/static 45 | nohup.out 46 | app_instance/ 47 | webui/app/b2share-bundle.js 48 | webui/app/b2share-bundle.js.map 49 | webui/app/lib/ 50 | webui/app/index.html 51 | webui/app/js/ 52 | webui/app/vendors/ 53 | webui/src/version.js 54 | webui/package-lock.json 55 | persistent_data/ 56 | __pycache__ 57 | webui/app/js/ 58 | CICD.md 59 | wheels 60 | .vscode 61 | ci-docker/data/ 62 | logs/ 63 | logs* 64 | -------------------------------------------------------------------------------- /.travis-release-requirements.txt: -------------------------------------------------------------------------------- 1 | -e git+git://github.com/mitsuhiko/werkzeug.git#egg=Werkzeug 2 | -e git+git://github.com/mitsuhiko/jinja2.git#egg=Jinja2 3 | -e git+git://github.com/mitsuhiko/itsdangerous.git#egg=itsdangerous 4 | -e git+git://github.com/jek/blinker.git#egg=blinker 5 | -e git+git://github.com/mitsuhiko/flask.git#egg=flask 6 | -e git+git://github.com/flask-admin/flask-admin.git#egg=Flask-Admin 7 | -e git+git://github.com/lepture/flask-wtf.git#egg=Flask-WTF 8 | 9 | -e git+git://github.com/inveniosoftware/dictdiffer.git#egg=dictdiffer 10 | -e git+git://github.com/inveniosoftware/intbitset.git#egg=intbitset 11 | -e git+git://github.com/inveniosoftware/invenio-client.git#egg=invenio-client 12 | -e git+git://github.com/inveniosoftware/workflow.git#egg=workflow 13 | -e git+git://github.com/inveniosoftware/flask-sso.git#egg=flask-sso 14 | -e git+git://github.com/inveniosoftware/flask-menu.git#egg=flask-menu 15 | -e git+git://github.com/inveniosoftware/flask-breadcrumbs.git#egg=flask-breadcrumbs 16 | -e git+git://github.com/inveniosoftware/flask-registry.git#egg=flask-registry 17 | -------------------------------------------------------------------------------- /docs/authors.rst: -------------------------------------------------------------------------------- 1 | .. This file is part of EUDAT B2Share. 2 | Copyright (C) 2016, CERN. 3 | 4 | B2Share is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; either version 2 of the 7 | License, or (at your option) any later version. 8 | 9 | B2Share is distributed in the hope that it will be useful, but 10 | WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with B2Share; if not, write to the Free Software Foundation, Inc., 16 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 17 | 18 | In applying this license, CERN does not 19 | waive the privileges and immunities granted to it by virtue of its status 20 | as an Intergovernmental Organization or submit itself to any jurisdiction. 21 | 22 | .. include:: ../AUTHORS.rst 23 | -------------------------------------------------------------------------------- /docs/installation.rst: -------------------------------------------------------------------------------- 1 | .. This file is part of EUDAT B2Share. 2 | Copyright (C) 2018, CERN. 3 | 4 | B2Share is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; either version 2 of the 7 | License, or (at your option) any later version. 8 | 9 | B2Share is distributed in the hope that it will be useful, but 10 | WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with B2Share; if not, write to the Free Software Foundation, Inc., 16 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 17 | 18 | In applying this license, CERN does not 19 | waive the privileges and immunities granted to it by virtue of its status 20 | as an Intergovernmental Organization or submit itself to any jurisdiction. 21 | 22 | .. include:: ../INSTALL.rst 23 | -------------------------------------------------------------------------------- /docs/contributing.rst: -------------------------------------------------------------------------------- 1 | .. This file is part of EUDAT B2Share. 2 | Copyright (C) 2016, CERN. 3 | 4 | B2Share is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; either version 2 of the 7 | License, or (at your option) any later version. 8 | 9 | B2Share is distributed in the hope that it will be useful, but 10 | WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with B2Share; if not, write to the Free Software Foundation, Inc., 16 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 17 | 18 | In applying this license, CERN does not 19 | waive the privileges and immunities granted to it by virtue of its status 20 | as an Intergovernmental Organization or submit itself to any jurisdiction. 21 | 22 | .. include:: ../CONTRIBUTING.rst 23 | -------------------------------------------------------------------------------- /b2share/modules/configloader/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2022 CSC Ltd, EUDAT CDI. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2SHARE specific configuration loader.""" 21 | 22 | from __future__ import absolute_import, print_function 23 | 24 | from .loader import create_b2share_config_loader 25 | 26 | __all__ = ('create_b2share_config_loader') 27 | -------------------------------------------------------------------------------- /b2share/modules/handle/proxies.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """Define B2SHARE Handle proxies.""" 21 | 22 | from __future__ import absolute_import 23 | 24 | from flask import current_app 25 | from werkzeug.local import LocalProxy 26 | 27 | current_handle = LocalProxy( 28 | lambda: current_app.extensions['b2share-handle']) 29 | -------------------------------------------------------------------------------- /dockerize/b2share.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # This file is supposed to live in a docker container 3 | 4 | mkdir -p /usr/var/b2share-instance 5 | 6 | # wait for all the services to start 7 | # FIXME: we should have some shell code to check that instead of a sleep. 8 | sleep 20 9 | 10 | if [ ! -f /usr/var/b2share-instance/state/provisioned ]; then 11 | 12 | # if a config file already exists, continue 13 | /usr/local/bin/b2share demo load_config || true 14 | 15 | if [ "${INIT_DB_AND_INDEX}" = "1" ]; then 16 | /usr/local/bin/b2share db init 17 | /usr/local/bin/b2share upgrade run -v 18 | sleep 20 19 | fi 20 | 21 | if [ "${LOAD_DEMO_COMMUNITIES_AND_RECORDS}" = "1" ]; then 22 | /usr/local/bin/b2share demo load_data 23 | elif [ "${INIT_DB_AND_INDEX}" = "1" ]; then 24 | # add default location 25 | /usr/local/bin/b2share files add-location 'local' file:///usr/var/b2share-instance/files --default 26 | fi 27 | 28 | touch /usr/var/b2share-instance/state/provisioned 29 | fi 30 | 31 | # safe to run even when up to date 32 | /usr/local/bin/b2share upgrade run -v 33 | 34 | /usr/bin/supervisord 35 | -------------------------------------------------------------------------------- /b2share/modules/deposit/mappings/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN, SurfSara. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """elasticsearch mappings""" -------------------------------------------------------------------------------- /b2share/modules/records/mappings/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN, SurfSara. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """elasticsearch mappings""" -------------------------------------------------------------------------------- /b2share/modules/handle/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2SHARE's Handle module. 21 | 22 | This module provide helpers enabling to create and manipulate EPIC Persistent 23 | Identifiers. 24 | """ 25 | 26 | from __future__ import absolute_import, print_function 27 | 28 | from .ext import B2ShareHandle 29 | 30 | __all__ = ('B2ShareHandle') 31 | -------------------------------------------------------------------------------- /b2share/modules/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | # 21 | # In applying this license, CERN does not 22 | # waive the privileges and immunities granted to it by virtue of its status 23 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 24 | 25 | """B2Share""" 26 | -------------------------------------------------------------------------------- /b2share/modules/records/serializers/schemas/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share Records Serialization schemas.""" 25 | -------------------------------------------------------------------------------- /b2share/modules/apiroot/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2Share apiroot module. 21 | 22 | This module simply gives information on the B2SHARE service via the root 23 | ``/api/`` endpoint. 24 | """ 25 | 26 | from __future__ import absolute_import, print_function 27 | 28 | from .ext import B2ShareApiRoot 29 | 30 | __all__ = ('B2ShareApiRoot') 31 | -------------------------------------------------------------------------------- /b2share/modules/linkset/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2Share ApiLinkset module. 21 | This module simply gives information on the B2SHARE service via the root 22 | ``/api/`` endpoint. 23 | """ 24 | 25 | from __future__ import absolute_import, print_function 26 | 27 | from .ext import B2ShareLinkset 28 | 29 | __all__ = ('B2ShareLinkset') 30 | -------------------------------------------------------------------------------- /b2share/modules/management/ownership/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """B2SHARE module providing Record-Ownership management features""" 22 | 23 | from __future__ import absolute_import, print_function 24 | 25 | from .ext import B2ShareOwnership 26 | 27 | __all__ = ('B2ShareOwnership') 28 | -------------------------------------------------------------------------------- /docs/changes.rst: -------------------------------------------------------------------------------- 1 | .. This file is part of EUDAT B2Share. 2 | Copyright (C) 2016, CERN. 3 | 4 | B2Share is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; either version 2 of the 7 | License, or (at your option) any later version. 8 | 9 | B2Share is distributed in the hope that it will be useful, but 10 | WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with B2Share; if not, write to the Free Software Foundation, Inc., 16 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 17 | 18 | In applying this license, CERN does not 19 | waive the privileges and immunities granted to it by virtue of its status 20 | as an Intergovernmental Organization or submit itself to any jurisdiction. 21 | 22 | Changes 23 | ======= 24 | 25 | The list of changes can be found here: 26 | https://github.com/EUDAT-B2SHARE/b2share/wiki/Release-Notes 27 | -------------------------------------------------------------------------------- /requirements.in: -------------------------------------------------------------------------------- 1 | celery>=3.1.24 2 | datacite>=0.3.0 3 | dcxml>=0.1.0 4 | dojson>=1.2.1 5 | doschema>=1.0.0a1 6 | easywebdav>=1.2.0 7 | elasticsearch<3.0.0,>=2.0.0 8 | elasticsearch-dsl<3.0.0,>=2.0.0 9 | Flask-Login<0.4,>=0.3.2 10 | httplib2>=0.9.2 11 | invenio-access<1.1.0,>=1.0.0a11 12 | invenio-accounts<1.1.0,>=1.0.0b5 13 | invenio-accounts-rest<1.1.0,>=1.0.0a4 14 | invenio-base<1.1.0,>=1.0.0a14 15 | invenio-celery<1.1.0,>=1.0.0b1 16 | invenio-config<1.1.0,>=1.0.0b2 17 | invenio-db[postgresql,versioning]<1.1.0,>=1.0.0b7 18 | invenio-deposit<1.1.0,>=1.0.0a8 19 | invenio-files-rest<1.1.0,>=1.0.0a21 20 | invenio-indexer>=1.0.0a9 21 | invenio-logging>=1.0.0a3 22 | invenio-mail<1.1.0,>=1.0.0b1 23 | invenio-marc21>=1.0.0a3 24 | invenio-oaiserver<1.1.0,>=1.0.0a9 25 | invenio-oauth2server<1.1.0,>=1.0.0a13 26 | invenio-oauthclient<1.1.0,>=1.0.0a13 27 | invenio-pidstore<1.1.0,>=v1.0.0b1 28 | invenio-query-parser<1.1.0,>=0.6.0 29 | invenio-records<1.1.0,>=1.0.0b1 30 | invenio-records-files<1.1.0,>=1.0.0a9 31 | invenio-records-rest<1.1.0,>=1.0.0a17 32 | invenio-rest[cors]<1.1.0,>=1.0.0a10 33 | invenio-search<1.1.0,>=1.0.0a10 34 | invenio-stats>=1.0.0a7 35 | jsonresolver[jsonschema]>=0.2.1 36 | psycopg2==2.9.5 37 | -------------------------------------------------------------------------------- /b2share/modules/communities/config.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share Communities module configuration.""" 25 | 26 | from __future__ import absolute_import, print_function 27 | -------------------------------------------------------------------------------- /b2share/modules/remotes/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2SHARE remote services module. 21 | 22 | This module enables interactions with the B2Drop service. 23 | """ 24 | 25 | from __future__ import absolute_import, print_function 26 | 27 | from .b2drop import B2DropClient 28 | from .ext import B2ShareRemotes 29 | 30 | __all__ = ('B2DropClient', 'B2ShareRemotes') 31 | -------------------------------------------------------------------------------- /tests/b2share_unit_tests/schemas/conftest.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Pytest configuration for b2share schemas module tests.""" 25 | 26 | from __future__ import absolute_import, print_function 27 | -------------------------------------------------------------------------------- /b2share/modules/records/constants.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Constants used in B2Share records module.""" 25 | 26 | RECORDS_INTERNAL_FIELD = '_internal' 27 | 28 | RECORDS_BUCKETS_FIELD = 'buckets' 29 | -------------------------------------------------------------------------------- /b2share/modules/handle/errors.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016, 2017 University of Tübingen, CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2SHARE Handle errors.""" 25 | 26 | class EpicPIDError(Exception): 27 | """Raise when the allocation of an EPIC PID failed.""" 28 | -------------------------------------------------------------------------------- /b2share/wsgi.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """b2share Invenio WSGI application.""" 25 | 26 | from __future__ import absolute_import, print_function 27 | 28 | from b2share.factory import create_app 29 | 30 | application = create_app() 31 | -------------------------------------------------------------------------------- /b2share/modules/stats/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2Share statistics module. 21 | 22 | This module works with invenio-stats. It adds a processor 23 | which is applied to new events in order to filter out events 24 | coming from deposits. This way the download statistics are 25 | calculated only for files of published records.""" 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | from .ext import B2ShareStatistics 30 | 31 | __all__ = ('B2ShareStatistics') -------------------------------------------------------------------------------- /demo/b2share_demo/data/records/bbmri/a1c2ef96-a1e4-46fa-9bd7-a2a46d2242d4.json: -------------------------------------------------------------------------------- 1 | { 2 | "titles": [ 3 | {"title":"REST paper 2014"} 4 | ], 5 | "descriptions": [ 6 | {"description":"REST mediates androgen receptor actions on gene repression and predicts early recurrence of prostate cancer", 7 | "description_type":"Abstract"} 8 | ], 9 | "resource_types": [ 10 | {"resource_type_general":"Text" } 11 | ], 12 | "keywords": [ 13 | "prostate cancer", 14 | "REST", 15 | "TFBS", 16 | "ChiP-seq" 17 | ], 18 | "contact_email": "x@example.com", 19 | "open_access": true, 20 | "community": "$COMMUNITY_ID[BBMRI]", 21 | "community_specific": { 22 | "$BLOCK_SCHEMA_ID[bbmri]": { 23 | "study_id": "REST", 24 | "study_name": "REST", 25 | "study_description": "REST mediates androgen receptor actions on gene repression and predicts early recurrence of prostate cancer", 26 | "principal_investigator": "Amilcar Flores", 27 | "study_design": ["Other"], 28 | "disease": "C61", 29 | "categories_of_data_collected": ["Biological samples"], 30 | "sex": ["Male"], 31 | "material_type": ["Other"] 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /b2share/celery.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016, 2017, 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | 21 | """Celery application factory.""" 22 | 23 | from __future__ import absolute_import, print_function 24 | 25 | from flask_celeryext import create_celery_app 26 | from invenio_celery import InvenioCelery 27 | from invenio_queues import InvenioQueues 28 | from invenio_search import InvenioSearch 29 | 30 | from invenio_stats import InvenioStats 31 | 32 | from .factory import create_app 33 | 34 | celery = create_celery_app(create_app()) 35 | 36 | __all__ = ['celery'] 37 | -------------------------------------------------------------------------------- /b2share/modules/deposit/utils.py: -------------------------------------------------------------------------------- 1 | """Utilities for B2share deposit.""" 2 | 3 | from flask import request 4 | from werkzeug.local import LocalProxy 5 | from werkzeug.routing import PathConverter 6 | from invenio_pidstore.errors import PIDInvalidAction 7 | from b2share.modules.deposit.api import Deposit 8 | 9 | 10 | def file_id_to_key(value): 11 | """Convert file UUID to value if in request context.""" 12 | from invenio_files_rest.models import ObjectVersion 13 | 14 | _, record = request.view_args['pid_value'].data 15 | if value in record.files: 16 | return value 17 | 18 | object_version = ObjectVersion.query.filter_by( 19 | bucket_id=record.files.bucket.id, file_id=value 20 | ).first() 21 | if object_version: 22 | return object_version.key 23 | return value 24 | 25 | 26 | def delete_deposit(deposit_pid): 27 | dep = Deposit.get_record(deposit_pid) 28 | not_published = (dep.status == 'draft') 29 | if not not_published: 30 | raise PIDInvalidAction() 31 | if dep.pid: 32 | dep.pid.delete() 33 | return dep.delete() 34 | 35 | class FileKeyConverter(PathConverter): 36 | """Convert file UUID for key.""" 37 | 38 | def to_python(self, value): 39 | """Lazily convert value from UUID to key if need be.""" 40 | return LocalProxy(lambda: file_id_to_key(value)) 41 | -------------------------------------------------------------------------------- /demo/setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2Share demonstration.""" 21 | 22 | from setuptools import find_packages, setup 23 | 24 | setup( 25 | name='b2share_demo', 26 | packages=find_packages(), 27 | entry_points={ 28 | 'invenio_base.api_apps': [ 29 | 'b2share_demo = b2share_demo:B2ShareDemo', 30 | ], 31 | # 'console_scripts': [ 32 | # 'b2share = b2share_demo.cli:cli' 33 | # ], 34 | }, 35 | install_requires=[ 36 | 'b2share>=2.0.0.beta-2', 37 | ], 38 | ) 39 | -------------------------------------------------------------------------------- /b2share/modules/communities/helpers.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """Helper functions for B2Share Communities module.""" 21 | 22 | from sqlalchemy import func 23 | 24 | from .api import Community 25 | from .errors import CommunityDoesNotExistError 26 | 27 | def get_community_by_name_or_id(community): 28 | result = None 29 | try: 30 | result = Community.get(id=community) 31 | except: 32 | try: 33 | result = Community.get(name=community) 34 | except CommunityDoesNotExistError: 35 | pass 36 | return result 37 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/alembic/456bf6bcb1e6_create_upgrade_table.py: -------------------------------------------------------------------------------- 1 | """Create upgrade table. 2 | 3 | Revision ID: 456bf6bcb1e6 4 | Revises: 53b6e1711607 5 | Create Date: 2017-05-04 11:51:49.599966 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | import uuid 11 | 12 | from b2share.version import __version__ 13 | from sqlalchemy_utils.types import JSONType, UUIDType 14 | from sqlalchemy.dialects import postgresql 15 | 16 | 17 | # revision identifiers, used by Alembic. 18 | revision = '456bf6bcb1e6' 19 | down_revision = '53b6e1711607' 20 | branch_labels = (u'b2share_upgrade',) 21 | depends_on = None 22 | 23 | 24 | def upgrade(): 25 | op.create_table( 26 | 'b2share_migrations', 27 | sa.Column('created', sa.DateTime(), nullable=False), 28 | sa.Column('updated', sa.DateTime(), nullable=False), 29 | sa.Column('id', UUIDType, default=uuid.uuid4, nullable=False), 30 | sa.Column('version', sa.String(80), default=__version__, 31 | nullable=False), 32 | sa.Column('data', JSONType().with_variant( 33 | postgresql.JSON(none_as_null=True), 34 | 'postgresql'), 35 | default=lambda: dict(), 36 | nullable=True), 37 | sa.PrimaryKeyConstraint('id') 38 | ) 39 | 40 | 41 | def downgrade(): 42 | op.drop_table('b2share_migrations') 43 | -------------------------------------------------------------------------------- /tests/data/communities/my_test_community2.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MyTestCommunity2", 3 | "description": "Test community.", 4 | "id": "cccccccc-2222-2222-2222-222222222222", 5 | "logo": "", 6 | "community_schemas": [ 7 | { 8 | "root_schema_version": 0, 9 | "json_schema": { 10 | "$schema": "http://json-schema.org/draft-04/schema#", 11 | "type": "object", 12 | "properties": { 13 | "$BLOCK_SCHEMA_ID[MyTestSchema]": { 14 | "$ref": 15 | "$BLOCK_SCHEMA_VERSION_URL[$BLOCK_SCHEMA_ID[MyTestSchema]::1]#/json_schema" 16 | } 17 | }, 18 | "additionalProperties": false 19 | } 20 | }, { 21 | "root_schema_version": 0, 22 | "json_schema": { 23 | "$schema": "http://json-schema.org/draft-04/schema#", 24 | "type": "object", 25 | "properties": { 26 | "$BLOCK_SCHEMA_ID[MyTestSchema]": { 27 | "$ref": 28 | "$BLOCK_SCHEMA_VERSION_URL[$BLOCK_SCHEMA_ID[MyTestSchema]::2]#/json_schema" 29 | } 30 | }, 31 | "additionalProperties": false 32 | } 33 | }], 34 | "block_schemas": { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /b2share/modules/oaiserver/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 University of Tuebingen, CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2share oai-pmh extension""" 21 | 22 | from __future__ import absolute_import, print_function 23 | 24 | from .cli import oai as oai_cmd 25 | 26 | class B2ShareOAIServer(object): 27 | """B2Share oai server extension.""" 28 | 29 | def __init__(self, app=None): 30 | """Extension initialization.""" 31 | if app: 32 | self.init_app(app) 33 | 34 | def init_app(self, app): 35 | """Flask application initialization.""" 36 | app.cli.add_command(oai_cmd) 37 | -------------------------------------------------------------------------------- /b2share/modules/oauthclient/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | # 21 | # In applying this license, CERN does not 22 | # waive the privileges and immunities granted to it by virtue of its status 23 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 24 | 25 | """B2SHARE oauthclient module. 26 | 27 | The oauthclient module is used to configure and add helper functions 28 | to invenio-oauthclient. 29 | 30 | Invenio-oauthclient is used in order to provide oauth authentication via 31 | B2ACCESS. 32 | """ 33 | -------------------------------------------------------------------------------- /b2share/modules/access/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share extension of the invenio-access module. 25 | 26 | This module provide helper classes enabling to extend the functionalities 27 | of Invenio-Access and Flask-Principal. 28 | """ 29 | 30 | from __future__ import absolute_import, print_function 31 | 32 | from .ext import B2ShareAccess 33 | 34 | __all__ = ('B2ShareAccess') 35 | -------------------------------------------------------------------------------- /b2share/modules/stats/processors.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """Statistics event preprocessors.""" 21 | 22 | from invenio_records_files.models import RecordsBuckets 23 | from invenio_records.models import RecordMetadata 24 | from b2share.modules.records.utils import is_deposit 25 | 26 | 27 | def skip_deposit(doc): 28 | """Check if event is coming from deposit file and skip.""" 29 | rb = RecordsBuckets.query.filter_by(bucket_id=doc['bucket_id']).first() 30 | record = RecordMetadata.query.filter_by(id=rb.record_id).first() 31 | if is_deposit(record): 32 | return None 33 | return doc 34 | -------------------------------------------------------------------------------- /b2share/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # This file is part of EUDAT B2Share. 3 | # Copyright (C) 2015 CERN. 4 | # 5 | # Invenio is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License as 7 | # published by the Free Software Foundation; either version 2 of the 8 | # License, or (at your option) any later version. 9 | # 10 | # Invenio is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Invenio; if not, write to the Free Software Foundation, Inc., 17 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | r"""EUDAT B2Share Digital Repository. 20 | 21 | B2SHARE is based on the Invenio framework. It uses multiple Invenio **modules** 22 | enabling the storage and processing and of its data. 23 | For a complete list of Invenio modules used by B2SHARE see the 24 | **requirements.txt** file. 25 | 26 | As an Invenio application, B2SHARE uses Flask to handle HTTP requests. A 27 | B2SHARE service is initialized by the function :func:`~.factory.create_app`. 28 | This function creates the Flask application and loads all B2SHARE and Invenio 29 | modules. 30 | 31 | """ 32 | 33 | from .version import __version__ 34 | 35 | 36 | __all__ = ("__version__",) 37 | -------------------------------------------------------------------------------- /demo/b2share_demo/data/records/rda/47077E3C-4B9F-4852-A407-09E338AD4620.json: -------------------------------------------------------------------------------- 1 | { 2 | "titles": [ 3 | {"title":"RDA Foundation Governance Document"} 4 | ], 5 | "descriptions": [ 6 | {"description":"A document describing the high-level structures of the Research Data Alliance Foundation. This document is separate from the regular governance document, which describes procedures and processes.", 7 | "description_type":"Abstract"} 8 | ], 9 | "creators": [ 10 | {"creator_name":"Research Data Alliance Council"}, 11 | {"creator_name":"RDA2"} 12 | ], 13 | "resource_types": [ 14 | {"resource_type_general":"Text"} 15 | ], 16 | "contact_email": "x@rd-alliance.org", 17 | "keywords": [ 18 | "Research Data Alliance", 19 | "RDA", 20 | "Governance", 21 | "Foundation", 22 | "RDA Policy" 23 | ], 24 | "license": { 25 | "license": "Creative Commons Attribution (CC-BY)", 26 | "license_uri": "http://creativecommons.org/licenses/by/4.0/" 27 | }, 28 | "alternate_identifiers": [ 29 | {"alternate_identifier":"10.15497/A675341C-F705-4136-B7C3-B9C14B556186", 30 | "alternate_identifier_type": "DOI"} 31 | ], 32 | "open_access": true, 33 | "community": "$COMMUNITY_ID[RDA]", 34 | "community_specific": { 35 | "$BLOCK_SCHEMA_ID[rda]": { 36 | "coverage": "Official Document", 37 | "format": "Text" 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /b2share/modules/communities/policies.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | # 21 | # In applying this license, CERN does not 22 | # waive the privileges and immunities granted to it by virtue of its status 23 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 24 | 25 | """Communities interface and API.""" 26 | 27 | from __future__ import absolute_import 28 | 29 | from .workflows import publication_workflows 30 | 31 | PolicyToggleValues = [True, False] 32 | 33 | PolicyValuesMapping = { 34 | 'restricted_submission': PolicyToggleValues, 35 | 'publication_workflow': publication_workflows.keys() 36 | } 37 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_1_1_to_2_1_2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Upgrade recipe migrating B2SHARE from version 2.1.1 to 2.1.2.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import pkg_resources 30 | 31 | from ..api import UpgradeRecipe 32 | 33 | 34 | migrate_2_1_1_to_2_1_2 = UpgradeRecipe('2.1.1', '2.1.2') 35 | 36 | # No changes to Elasticsearch mappings 37 | 38 | # There are no changes to the db schema, so no other updates are necessary 39 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_1_2_to_2_1_3.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Upgrade recipe migrating B2SHARE from version 2.1.2 to 2.1.3.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import pkg_resources 30 | 31 | from ..api import UpgradeRecipe 32 | 33 | 34 | migrate_2_1_2_to_2_1_3 = UpgradeRecipe('2.1.2', '2.1.3') 35 | 36 | # No changes to Elasticsearch mappings 37 | 38 | # There are no changes to the db schema, so no other updates are necessary 39 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_1_3_to_2_1_4.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Upgrade recipe migrating B2SHARE from version 2.1.3 to 2.1.4.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import pkg_resources 30 | 31 | from ..api import UpgradeRecipe 32 | 33 | 34 | migrate_2_1_3_to_2_1_4 = UpgradeRecipe('2.1.3', '2.1.4') 35 | 36 | # No changes to Elasticsearch mappings 37 | 38 | # There are no changes to the db schema, so no other updates are necessary 39 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_1_4_to_2_1_5.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Upgrade recipe migrating B2SHARE from version 2.1.4 to 2.1.5.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import pkg_resources 30 | 31 | from ..api import UpgradeRecipe 32 | 33 | 34 | migrate_2_1_3_to_2_1_4 = UpgradeRecipe('2.1.4', '2.1.5') 35 | 36 | # No changes to Elasticsearch mappings 37 | 38 | # There are no changes to the db schema, so no other updates are necessary 39 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_1_5_to_2_1_6.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Upgrade recipe migrating B2SHARE from version 2.1.5 to 2.1.6.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import pkg_resources 30 | 31 | from ..api import UpgradeRecipe 32 | 33 | 34 | migrate_2_1_5_to_2_1_6 = UpgradeRecipe('2.1.5', '2.1.6') 35 | 36 | # No changes to Elasticsearch mappings 37 | 38 | # There are no changes to the db schema, so no other updates are necessary 39 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_1_6_to_2_1_7.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Upgrade recipe migrating B2SHARE from version 2.1.6 to 2.1.7.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import pkg_resources 30 | 31 | from ..api import UpgradeRecipe 32 | 33 | 34 | migrate_2_1_5_to_2_1_6 = UpgradeRecipe('2.1.6', '2.1.7') 35 | 36 | # No changes to Elasticsearch mappings 37 | 38 | # There are no changes to the db schema, so no other updates are necessary 39 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_2_0_to_2_2_1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Upgrade recipe migrating B2SHARE from version 2.1.4 to 2.1.5.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import pkg_resources 30 | 31 | from ..api import UpgradeRecipe 32 | 33 | 34 | migrate_2_2_0_to_2_2_1 = UpgradeRecipe('2.2.0', '2.2.1') 35 | 36 | # No changes to Elasticsearch mappings 37 | 38 | # There are no changes to the db schema, so no other updates are necessary 39 | -------------------------------------------------------------------------------- /webui/src/documentation.md: -------------------------------------------------------------------------------- 1 | # General 2 | 3 | The B2SHARE web UI is a Single Page Application, based on react and on a custom "flux" architecture. It uses the following libraries: 4 | 5 | - react-router, for routing URLs on the client side 6 | - react-widgets and react-toggle for widgets (mostly used when editing records) 7 | - a customized bootstrap theme, but only the css part 8 | - immutable.js, which is used for defining an immutable data store 9 | - reqwest.js, for the asynchronous ajax calls to the server 10 | - moment.js, for simple manipulation and formatting of time 11 | 12 | Some libraries are also used, for very specific purposes (computing a json patch, icons) 13 | 14 | The flux architecture style is implemented in a custom way by the B2SHARE UI: 15 | 16 | 1. a user event or page load event trigger an ajax query from the server 17 | - all server events are handled in src/data/server.js 18 | 2. the callback of the ajax call places the data returned from the server in an immutable data store 19 | 3. each update of the data store automatically triggers a new repaint of the application 20 | - see src/main.jsx, updateStateOnTick in AppFrame 21 | 4. the application repaint uses the data from the store as parameters for the react components 22 | 23 | Therefore a user event very rarely changes local state of the react components, but usually just calls some function in server.js, which will asynchronously eventually change the data store, which will trigger a repaint, so the user would get a refreshed view. 24 | -------------------------------------------------------------------------------- /webui/src/__tests__/common.js: -------------------------------------------------------------------------------- 1 | import Nightmare from 'nightmare'; 2 | 3 | jasmine.DEFAULT_TIMEOUT_INTERVAL=20*1000; 4 | 5 | export const nightmareConfig = { 6 | // show: true, 7 | switches: { 8 | 'ignore-certificate-errors': true, 9 | }, 10 | }; 11 | 12 | export const B2ACCESS_AUTH_URL = "https://unity.eudat-aai.fz-juelich.de:8443/oauth2-as/oauth2-authz-web-entry"; 13 | 14 | export const B2SHARE_URL = process.env.B2SHARE_URL || process.env.B2SHARE_JSONSCHEMAS_HOST; 15 | export const USER_NAME = process.env.AUTOTEST_USER; 16 | export const USER_PASS = process.env.AUTOTEST_PASS; 17 | export const USER_EMAIL = process.env.AUTOTEST_EMAIL; 18 | 19 | if (!B2SHARE_URL) { 20 | console.log("B2SHARE_URL environment variables not defined!"); 21 | } 22 | 23 | if (!USER_NAME || !USER_PASS || !USER_EMAIL) { 24 | console.log("username or password or email environment variables not defined!"); 25 | } 26 | 27 | export function step(msg) { 28 | console.log(msg, "..."); 29 | } 30 | 31 | export function print_obj(o) { 32 | for (var p in o) { 33 | console.log(p); 34 | } 35 | } 36 | 37 | export async function assertPageContains(page, text) { 38 | let body = await page.evaluate(()=>document.body.textContent); 39 | await expect(body).toContain(text); 40 | } 41 | 42 | export async function assertElementText(page, selector, text) { 43 | const fn = (selector) => { 44 | document.querySelector(selector).innerText 45 | }; 46 | let elementText = await page.evaluate(fn, selector); 47 | return expect(elementText == text); 48 | } 49 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2Share upgrade extension""" 21 | 22 | from __future__ import absolute_import, print_function 23 | 24 | from .cli import upgrade as upgrade_cmd 25 | 26 | 27 | class B2ShareUpgrade(object): 28 | """B2Share upgrade extension.""" 29 | 30 | def __init__(self, app=None): 31 | """Extension initialization.""" 32 | if app: 33 | self.init_app(app) 34 | 35 | def init_app(self, app): 36 | """Flask application initialization.""" 37 | self.init_config(app) 38 | app.cli.add_command(upgrade_cmd) 39 | app.extensions['b2share-upgrade'] = self 40 | 41 | def init_config(self, app): 42 | """Initialize configuration.""" 43 | pass 44 | -------------------------------------------------------------------------------- /b2share/modules/oaiserver/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 University of Tübingen 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share oaiserver module. 25 | 26 | This module works with invenio-oaiserver to provide a 27 | command line interface for checking and fixing OAI PMH sets. 28 | 29 | 30 | OAI-PMH is the protocol used by B2SHARE in order to be harvestable. B2Find uses 31 | it to create a catalogue of every record in a B2SHARE service. 32 | """ 33 | 34 | from __future__ import absolute_import, print_function 35 | 36 | from .ext import B2ShareOAIServer 37 | 38 | __all__ = ('B2ShareOAIServer') 39 | -------------------------------------------------------------------------------- /b2share/modules/apiroot/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2share api root extension""" 21 | 22 | from __future__ import absolute_import, print_function 23 | 24 | from .views import blueprint 25 | 26 | 27 | class B2ShareApiRoot(object): 28 | """B2Share Api Root extension.""" 29 | 30 | def __init__(self, app=None): 31 | """Extension initialization.""" 32 | if app: 33 | self.init_app(app) 34 | 35 | def init_app(self, app): 36 | """Flask application initialization.""" 37 | self.init_config(app) 38 | app.extensions['b2share-apiroot'] = self 39 | app.register_blueprint(blueprint) 40 | 41 | def init_config(self, app): 42 | """Initialize configuration.""" 43 | pass 44 | -------------------------------------------------------------------------------- /b2share/modules/records/loaders.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN, University of Tübingen. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share record input loaders.""" 25 | 26 | from b2share.modules.deposit.loaders import ( 27 | IMMUTABLE_PATHS as DEPOSIT_IMMUTABLE_PATHS, 28 | check_patch_input_loader 29 | ) 30 | 31 | 32 | IMMUTABLE_PATHS = DEPOSIT_IMMUTABLE_PATHS.union({ 33 | # additional fields immutable for a published record 34 | '/publication_state', 35 | '/external_pids', 36 | }) 37 | 38 | def record_patch_input_loader(record=None): 39 | return check_patch_input_loader(record, IMMUTABLE_PATHS) 40 | -------------------------------------------------------------------------------- /tests/b2share_unit_tests/communities/test_communities_ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Test B2Share communities module.""" 25 | 26 | from flask import Flask 27 | 28 | from b2share.modules.communities import B2ShareCommunities 29 | 30 | 31 | def test_init(): 32 | """Test extension initialization.""" 33 | app = Flask('testapp') 34 | app.config.update(SERVER_NAME='http://localhost:5000/') 35 | ext = B2ShareCommunities() 36 | assert 'b2share-communities' not in app.extensions 37 | ext.init_app(app) 38 | assert 'b2share-communities' in app.extensions 39 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. This file is part of EUDAT B2Share. 2 | Copyright (C) 2016, 2018 CERN. 3 | 4 | B2Share is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License as 6 | published by the Free Software Foundation; either version 2 of the 7 | License, or (at your option) any later version. 8 | 9 | B2Share is distributed in the hope that it will be useful, but 10 | WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with B2Share; if not, write to the Free Software Foundation, Inc., 16 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 17 | 18 | In applying this license, CERN does not 19 | waive the privileges and immunities granted to it by virtue of its status 20 | as an Intergovernmental Organization or submit itself to any jurisdiction. 21 | 22 | .. include:: ../README.rst 23 | 24 | Developer's Guide 25 | ----------------- 26 | 27 | This part of the documentation will show you how to get started in using 28 | B2Share. 29 | 30 | .. toctree:: 31 | :maxdepth: 2 32 | 33 | installation 34 | administration 35 | architecture 36 | 37 | Additional Notes 38 | ---------------- 39 | 40 | Notes on how to contribute, legal information and changes are here for the 41 | interested. 42 | 43 | .. toctree:: 44 | :maxdepth: 2 45 | 46 | contributing 47 | changes 48 | license 49 | authors 50 | -------------------------------------------------------------------------------- /webui/app/license-selector.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | License Selector 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /b2share/modules/communities/alembic/fb99eeaec4ac_create_communities_tables.py: -------------------------------------------------------------------------------- 1 | """Create communities tables. 2 | 3 | Revision ID: fb99eeaec4ac 4 | Revises: ec77f5a034d1 5 | Create Date: 2017-04-25 17:45:13.538252 6 | 7 | """ 8 | import uuid 9 | 10 | from alembic import op 11 | import sqlalchemy as sa 12 | from sqlalchemy.sql import expression 13 | from sqlalchemy.types import TIMESTAMP 14 | from sqlalchemy_utils.types import UUIDType 15 | 16 | 17 | # revision identifiers, used by Alembic. 18 | revision = 'fb99eeaec4ac' 19 | down_revision = 'ec77f5a034d1' # communities-create-branch 20 | branch_labels = () 21 | depends_on = None 22 | 23 | 24 | def upgrade(): 25 | op.create_table( 26 | 'b2share_community', 27 | sa.Column('created', TIMESTAMP, nullable=False), 28 | sa.Column('updated', TIMESTAMP, nullable=False), 29 | sa.Column('id', UUIDType, default=uuid.uuid4, nullable=False), 30 | sa.Column('name', sa.String(80), unique=True, nullable=False), 31 | sa.Column('description', sa.String(2000), nullable=False), 32 | sa.Column('logo', sa.String(300), nullable=True), 33 | sa.Column('deleted', sa.Boolean, nullable=False, 34 | server_default=expression.false()), 35 | sa.Column('publication_workflow', sa.String(80), nullable=False, 36 | default='direct_publish'), 37 | sa.Column('restricted_submission', sa.Boolean, nullable=False, 38 | server_default=expression.false(), default=False), 39 | sa.PrimaryKeyConstraint('id') 40 | ) 41 | 42 | 43 | def downgrade(): 44 | op.drop_table('b2share_community') 45 | -------------------------------------------------------------------------------- /b2share/modules/configloader/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2022 CSC Ltd, EUDAT CDI. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """Utilities for B2SHARE config loader.""" 21 | 22 | def _check_config_exists( 23 | app, 24 | required_config_variables, 25 | optional_config_variables 26 | ): 27 | """.""" 28 | config_complete = True 29 | for c in required_config_variables: 30 | if app.config.get(c, None) in ("", [], None): 31 | app.logger.warning( 32 | f"REQUIRED config variable {c} has an empty value" 33 | ) 34 | config_complete = False 35 | 36 | for c in optional_config_variables: 37 | if app.config.get(c, None) in ("", [], None): 38 | app.logger.info( 39 | f"Optional config variable {c} has an empty value" 40 | ) 41 | 42 | return config_complete 43 | -------------------------------------------------------------------------------- /demo/b2share_demo/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2share demonstration extension""" 21 | 22 | from __future__ import absolute_import, print_function 23 | 24 | from .cli import demo as demo_cmd 25 | from .migration_cli import migrate as migrate_cmd 26 | 27 | 28 | class B2ShareDemo(object): 29 | """B2Share Demonstration extension.""" 30 | 31 | def __init__(self, app=None): 32 | """Extension initialization.""" 33 | if app: 34 | self.init_app(app) 35 | 36 | def init_app(self, app): 37 | """Flask application initialization.""" 38 | self.init_config(app) 39 | app.extensions['b2share-demo'] = self 40 | app.cli.add_command(demo_cmd) 41 | app.cli.add_command(migrate_cmd) 42 | 43 | def init_config(self, app): 44 | """Initialize configuration.""" 45 | pass 46 | -------------------------------------------------------------------------------- /tests/b2share_functional_tests/conftests.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Functional tests' fixtures.""" 25 | 26 | from __future__ import absolute_import, print_function 27 | 28 | import pytest 29 | from b2share.factory import create_app 30 | 31 | # @pytest.fixture(scope='function') 32 | # def app(request, tmpdir): 33 | # """Flask application fixture.""" 34 | # instance_dir = tmpdir.mkdir('instance_dir') 35 | 36 | # os.environ.update( 37 | # B2SHARE_INSTANCE_PATH=os.environ.get( 38 | # 'INSTANCE_PATH', instance_dir), 39 | # ) 40 | # with app.app_context(): 41 | # yield app 42 | -------------------------------------------------------------------------------- /b2share/modules/deposit/serializers/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share serializers.""" 25 | 26 | from __future__ import absolute_import, print_function 27 | 28 | from invenio_records_rest.serializers.response import search_responsify 29 | from b2share.modules.records.serializers.schemas.json import DraftSchemaJSONV1 30 | 31 | from b2share.modules.records.serializers.response import record_responsify, \ 32 | JSONSerializer 33 | 34 | json_v1 = JSONSerializer(DraftSchemaJSONV1) 35 | json_v1_response = record_responsify(json_v1, 'application/json') 36 | json_v1_search = search_responsify(json_v1, 'application/json') 37 | -------------------------------------------------------------------------------- /b2share/modules/linkset/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2share api root extension""" 21 | 22 | from __future__ import absolute_import, print_function 23 | 24 | from .views import blueprint 25 | 26 | from .cli import linkset as linkset_cmd 27 | 28 | class B2ShareLinkset(object): 29 | """B2Share Api Archive extension.""" 30 | 31 | def __init__(self, app=None): 32 | """Extension initialization.""" 33 | if app: 34 | self.init_app(app) 35 | 36 | def init_app(self, app): 37 | """Flask application initialization.""" 38 | self.init_config(app) 39 | app.cli.add_command(linkset_cmd) 40 | app.extensions['b2share_apilinkset'] = self 41 | app.register_blueprint(blueprint) 42 | 43 | def init_config(self, app): 44 | """Initialize configuration.""" 45 | pass 46 | -------------------------------------------------------------------------------- /b2share/modules/deposit/fetchers.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """PID Fetchers.""" 25 | 26 | from collections import namedtuple 27 | 28 | from .providers import DepositUUIDProvider 29 | 30 | 31 | FetchedPID = namedtuple('FetchedPID', ['provider', 'object_uuid', 32 | 'pid_type', 'pid_value']) 33 | 34 | 35 | def b2share_deposit_uuid_fetcher(record_uuid, data): 36 | """Fetch a deposit's identifiers.""" 37 | return FetchedPID( 38 | provider=DepositUUIDProvider, 39 | object_uuid=record_uuid, 40 | pid_type=DepositUUIDProvider.pid_type, 41 | pid_value=str(data['_deposit']['id']), 42 | ) 43 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/cli.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share cli commands for upgrades.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import click 30 | from flask.cli import with_appcontext 31 | from flask import current_app 32 | 33 | from .api import upgrade_to_last_version 34 | 35 | @click.group() 36 | def upgrade(): 37 | """B2SHARE upgrade commands.""" 38 | 39 | 40 | @upgrade.command() 41 | @with_appcontext 42 | @click.option('-v', '--verbose', is_flag=True, default=False) 43 | def run(verbose): 44 | """Upgrade the database to the last version and reindex the records.""" 45 | upgrade_to_last_version(verbose) 46 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/errors.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2SHARE upgrade module errors.""" 25 | 26 | import json 27 | 28 | from click import ClickException 29 | 30 | 31 | class MigrationFromUnknownVersionError(ClickException): 32 | """Exception raised when upgrading an unknown version of B2SHARE.""" 33 | exit_code=422 34 | 35 | def __init__(self, current_version, wanted_version): 36 | ClickException.__init__( 37 | self, 'Cannot migrate from version {0} to version ' 38 | '{1}'.format(current_version, wanted_version) 39 | ) 40 | self.current_version = current_version 41 | self.wanted_version = wanted_version 42 | -------------------------------------------------------------------------------- /b2share/modules/files/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """B2Share files module. 21 | 22 | The files module provides the storage class for files with external PIDs 23 | and background tasks for file checksum verification. 24 | 25 | The storage class B2ShareFileStorage is assigned to files with external PIDs 26 | in order to change the procedure when downloading and 27 | redirect to the PID instead of starting a file download. 28 | 29 | The API for interacting with files is provided directly by invenio-files-rest. 30 | 31 | The permissions in the files REST API dictate that files cannot be changed 32 | if their record is published. 33 | Also, the files of a draft can only be modified by the creator of the draft 34 | or the community administrator. 35 | """ 36 | 37 | from __future__ import absolute_import, print_function 38 | 39 | from .ext import B2ShareFiles 40 | 41 | __all__ = ('B2ShareFiles') 42 | -------------------------------------------------------------------------------- /webui/src/__tests__/homepage.js: -------------------------------------------------------------------------------- 1 | import Nightmare from 'nightmare'; 2 | import { B2ACCESS_AUTH_URL, B2SHARE_URL, USER_NAME, USER_PASS, USER_EMAIL, 3 | nightmareConfig, step, print_obj, assertPageContains, assertElementText } from './common'; 4 | 5 | 6 | describe('Homepage', function () { 7 | test('well formed homepage', async function () { 8 | let page = Nightmare(nightmareConfig).goto(B2SHARE_URL); 9 | expect(await page.title() == 'B2SHARE'); 10 | 11 | await page.wait('#header-navbar-collapse a'); 12 | await page.wait('#page .home-page .record a'); 13 | }); 14 | }); 15 | 16 | describe('Login', function () { 17 | test('user can login', async function () { 18 | let page = Nightmare(nightmareConfig).goto(B2SHARE_URL); 19 | 20 | await page.wait('#header-navbar-collapse > .user > li > a') 21 | .click('#header-navbar-collapse > .user > li > a'); 22 | 23 | await expect(page.url() == B2ACCESS_AUTH_URL); 24 | 25 | await page.wait('#AuthenticationUI\\.username'); 26 | await assertPageContains(page, "Login to UNITY OAuth2 Authorization Server"); 27 | 28 | await page.type('#AuthenticationUI\\.username', USER_NAME) 29 | .type('#WebPasswordRetrieval\\.password', USER_PASS) 30 | .click('#AuthenticationUI\\.authnenticateButton') 31 | .wait('#IdpButtonsBar\\.confirmButton') 32 | .click('#IdpButtonsBar\\.confirmButton'); 33 | 34 | expect(await page.title() == 'B2SHARE'); 35 | 36 | await page.wait('#header-navbar-collapse a'); 37 | 38 | await assertElementText(page, '#header-navbar-collapse > .user > li > a', USER_EMAIL); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /b2share/modules/stats/aggregations.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | from invenio_search import current_search_client 21 | from invenio_stats.aggregations import StatAggregator 22 | 23 | """Statistics aggregations.""" 24 | 25 | def register_aggregations(): 26 | """Register additional stats aggregations.""" 27 | return [dict( 28 | aggregation_name='record-view-agg', 29 | templates='contrib/aggregations/aggr_record_view/v2', 30 | aggregator_class=StatAggregator, 31 | aggregator_config=dict( 32 | client=current_search_client, 33 | event='record-view', 34 | aggregation_field='unique_id', 35 | aggregation_interval='day', 36 | copy_fields=dict( 37 | record_id='record_id', 38 | pid_type='pid_type', 39 | pid_value='pid_value', 40 | community='community' 41 | ) 42 | ))] 43 | -------------------------------------------------------------------------------- /b2share/modules/stats/registrations.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # Copyright (C) 2023 CSC 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | from invenio_stats.processors import EventsIndexer, anonymize_user, flag_robots 22 | from invenio_stats.contrib.event_builders import build_file_unique_id 23 | 24 | """Statistics registrations.""" 25 | 26 | def register_events(): 27 | """Register record-view events.""" 28 | return [ 29 | dict( 30 | event_type='b2share-file-download', 31 | templates='contrib/file_download', 32 | processor_class=EventsIndexer, 33 | processor_config=dict( 34 | preprocessors=[ 35 | flag_robots, 36 | anonymize_user, 37 | build_file_unique_id 38 | ])), 39 | dict( 40 | event_type='b2share-record-view', 41 | templates='contrib/record_view', 42 | processor_class=EventsIndexer)] 43 | -------------------------------------------------------------------------------- /requirements-devel.txt: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | -e git+https://github.com/inveniosoftware/invenio-deposit.git#egg=invenio-deposit 21 | -e git+git://github.com/inveniosoftware/invenio-base.git#egg=invenio-base 22 | -e git+git://github.com/inveniosoftware/invenio-rest.git#egg=invenio-rest 23 | -e git+git://github.com/inveniosoftware/invenio-pidstore.git#egg=invenio-pidstore 24 | -e git+git://github.com/inveniosoftware/invenio-records.git#egg=invenio-records 25 | -e git+git://github.com/inveniosoftware/invenio-search.git#egg=invenio-search 26 | -e git+git://github.com/inveniosoftware/invenio-oaiserver.git#egg=invenio-oaiserver 27 | -e git+git://github.com/inveniosoftware/invenio-records-rest.git#egg=invenio-records-rest 28 | -e git+git://github.com/inveniosoftware/invenio-accounts-rest.git#egg=invenio-accounts-rest 29 | -e git+git://github.com/inveniosoftware/invenio-stats.git#egg=invenio-stats 30 | -e git+git://github.com/inveniosoftware/doschema.git#egg=doschema 31 | -------------------------------------------------------------------------------- /webui/src/components/help.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react/lib/ReactWithAddons'; 2 | import { Link } from 'react-router'; 3 | import { serverCache, Error } from '../data/server'; 4 | 5 | 6 | export const Help = React.createClass({ 7 | listLinks(links) { 8 | return 16 | }, 17 | 18 | render() { 19 | const info = serverCache.getInfo(); 20 | const helplinks = info.get('help_links', new Map); 21 | const links = { 22 | 'What is B2SHARE?': ['https://eudat.eu/services/b2share', 'fa-list'], 23 | 'User Guide': [helplinks.get('user-guide'), 'fa-file'], 24 | 'Search': [helplinks.get('search'), 'fa-info-circle'], 25 | 'REST API': [helplinks.get('rest-api'), 'fa-info-circle'], 26 | // 'Annotation with B2NOTE': [helplinks.get('b2note'), 'fa-list'], 27 | 'Terms of Use': [info.get('terms_of_use_link'), 'fa-question-circle'], 28 | 'Report an issue': [helplinks.get('issues'), 'fa-exclamation-circle'] 29 | } 30 | 31 | return ( 32 |
33 |

Help

34 |
35 |
36 | {this.listLinks(links)} 37 |
38 |
39 |
40 | ); 41 | } 42 | }); 43 | -------------------------------------------------------------------------------- /b2share/modules/remotes/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | # 21 | # In applying this license, CERN does not 22 | # waive the privileges and immunities granted to it by virtue of its status 23 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 24 | 25 | """B2share integration with remote services""" 26 | 27 | from __future__ import absolute_import, print_function 28 | from .views import blueprint 29 | 30 | 31 | class B2ShareRemotes(object): 32 | def __init__(self, app=None): 33 | """Extension initialization.""" 34 | if app: 35 | self.init_app(app) 36 | 37 | def init_app(self, app): 38 | """Flask application initialization.""" 39 | self.init_config(app) 40 | app.register_blueprint(blueprint) 41 | app.extensions['b2share-remotes'] = self 42 | 43 | def init_config(self, app): 44 | """Initialize configuration.""" 45 | pass 46 | -------------------------------------------------------------------------------- /b2share/modules/schemas/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """B2share schemas extension""" 22 | 23 | from __future__ import absolute_import, print_function 24 | 25 | from .cli import schemas as schemas_cmd 26 | from .views import blueprint 27 | from .errors import register_error_handlers 28 | 29 | 30 | class B2ShareSchemas(object): 31 | """B2Share Schemas extension.""" 32 | 33 | def __init__(self, app=None): 34 | """Extension initialization.""" 35 | if app: 36 | self.init_app(app) 37 | 38 | def init_app(self, app): 39 | """Flask application initialization.""" 40 | self.init_config(app) 41 | app.register_blueprint(blueprint) 42 | app.cli.add_command(schemas_cmd) 43 | app.extensions['b2share-schemas'] = self 44 | register_error_handlers(app) 45 | 46 | def init_config(self, app): 47 | """Initialize configuration.""" 48 | pass 49 | -------------------------------------------------------------------------------- /demo/b2share_demo/data/communities/lter.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "LTER", 3 | "description": "Long-Term Ecosystem Research in Europe", 4 | "logo": "/img/communities/lter.jpg", 5 | "id": "d952913c-451e-4b5c-817e-d578dc8a4469", 6 | "publication_workflow": "direct_publish", 7 | "restricted_submission": false, 8 | "community_schemas": [ 9 | { 10 | "json_schema": { 11 | "properties": { 12 | "$BLOCK_SCHEMA_ID[lter]": { 13 | "$ref": "$BLOCK_SCHEMA_VERSION_URL[$BLOCK_SCHEMA_ID[lter]::0]#/json_schema" 14 | } 15 | }, 16 | "$schema": "http://json-schema.org/draft-04/schema#", 17 | "additionalProperties": false, 18 | "required": ["$BLOCK_SCHEMA_ID[lter]"], 19 | "type": "object" 20 | }, 21 | "root_schema_version": 0 22 | } 23 | ], 24 | "block_schemas": { 25 | "lter": { 26 | "id": "27193e5b-97e6-4f6f-8e87-3694589bcebe", 27 | "versions": [ 28 | { 29 | "$schema": "http://json-schema.org/draft-04/schema#", 30 | "description": "This is the blueprint of the metadata block specific for the LTER community", 31 | "title": "LTER Metadata", 32 | "type": "object", 33 | "properties": { 34 | "metadata_url": { 35 | "title": "Metadata URL", 36 | "description": "Metadata URL", 37 | "type": "string" 38 | } 39 | }, 40 | "additionalProperties": false 41 | } 42 | ] 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /webui/webpack.config.devel.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var webpack = require('webpack'); 3 | const Dotenv = require('dotenv-webpack'); 4 | var WatchTimePlugin = require('webpack-watch-time-plugin'); 5 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 6 | const CleanWebpackPlugin = require('clean-webpack-plugin'); 7 | 8 | console.log("Using configuration file from", __dirname+'/../webui.cfg'); 9 | 10 | let cleanOptions = { 11 | root: __dirname+'/app', 12 | verbose: true, 13 | dry: false 14 | } 15 | 16 | 17 | module.exports = { 18 | entry: ['./src/main.jsx'], 19 | devtool: 'cheap-module-eval-source-map', 20 | output: { path: __dirname+"/app/", filename: 'js/b2share-bundle.[hash].js'}, 21 | plugins: [ 22 | // Note: Only values used in source code will be included in the bundle. 23 | // See dotenv-webpack documentation for more details. 24 | new Dotenv({ 25 | path: __dirname+'/../webui.cfg', // load this file instead of '.env'. 26 | systemvars: true, // load environment variables from 'process.env'. 27 | }), 28 | WatchTimePlugin, 29 | new CleanWebpackPlugin('js', cleanOptions), 30 | //inject false prevents script tag from being automatically injected 31 | //the script tag is injected directly in index_template.html code instead 32 | new HtmlWebpackPlugin({ 33 | inject: false, 34 | hash: false, 35 | template: 'templates/index_template.html', 36 | filename: 'index.html' 37 | }), 38 | ], 39 | module: { 40 | loaders: [ 41 | { test: /\.jsx?$/, 42 | loader: 'babel-loader', 43 | query: { presets: ['es2015', 'react'] }, 44 | include: path.join(__dirname, 'src') 45 | } 46 | ] 47 | } 48 | }; 49 | 50 | -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | .. This file is part of EUDAT B2Share. 2 | Copyright (C) 2017, CERN. 3 | Copyright (C) 2016, CERN. 4 | 5 | B2Share is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License as 7 | published by the Free Software Foundation; either version 2 of the 8 | License, or (at your option) any later version. 9 | 10 | B2Share is distributed in the hope that it will be useful, but 11 | WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with B2Share; if not, write to the Free Software Foundation, Inc., 17 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 18 | 19 | In applying this license, CERN does not 20 | waive the privileges and immunities granted to it by virtue of its status 21 | as an Intergovernmental Organization or submit itself to any jurisdiction. 22 | 23 | Authors 24 | ======= 25 | 26 | - Adrian Mouat (KTH) 27 | - Carl Johan Håkansson (KTH) 28 | - Dennis Blommesteijn (SURFsara) 29 | - Dinos Kousidis (CERN) 30 | - Emanuel Dima (EKUT) 31 | - Hans van Piggelen (SURF) 32 | - Harri Hirvonsalo (CSC) 33 | - Harry Kodden (SURF) 34 | - Hilary Hanahoe (TRUST) 35 | - Huw Morris (STFC) 36 | - Ilja Livenson (KTH) 37 | - Janne Karjalainen (CSC) 38 | - Jussi Steenari (CSC) 39 | - Klára Pešková (CUNI) 40 | - Kristian Niininen (CSC) 41 | - Lassi Lehtinen (CSC) 42 | - Mikael Karlsson (CSC) 43 | - Martin Philipp Hellmich (CERN) 44 | - Nicolas Harraudeau (CERN) 45 | - Paulina Lach (CERN) 46 | - Pavel Straňák (CUNI) 47 | - Pietari Hyvärinen (CSC) 48 | - Sarah Berenji Ardestani (KTH) 49 | - Stefan Wolfsheimer (SURFsara) 50 | - Thijs Cobben (SURFsara) 51 | - Urpo Kaila (CSC) 52 | -------------------------------------------------------------------------------- /b2share/modules/stats/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """B2share Stats extension""" 22 | 23 | from __future__ import absolute_import, print_function 24 | 25 | from .views import blueprint 26 | 27 | 28 | class _B2ShareStatistics(object): 29 | """B2share Stats extension state.""" 30 | 31 | def __init__(self, app): 32 | """Constructor. 33 | 34 | Args: 35 | app: the Flask application. 36 | """ 37 | self.app = app 38 | 39 | 40 | class B2ShareStatistics(object): 41 | """B2share Stats extension.""" 42 | 43 | def __init__(self, app=None): 44 | """Extension initialization.""" 45 | if app: 46 | self.init_app(app) 47 | 48 | def init_app(self, app): 49 | """Flask application initialization.""" 50 | self.init_config(app) 51 | app.extensions['b2share-statistics'] =_B2ShareStatistics(app) 52 | app.register_blueprint(blueprint) 53 | 54 | def init_config(self, app): 55 | pass 56 | -------------------------------------------------------------------------------- /b2share/modules/upgrade/upgrades/upgrade_2_1_0_to_2_1_1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2018 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Upgrade recipe migrating B2SHARE from version 2.1.0 to 2.1.1.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import pkg_resources 30 | 31 | from ..api import UpgradeRecipe 32 | from .common import elasticsearch_index_destroy, elasticsearch_index_init, \ 33 | elasticsearch_index_reindex, queues_declare, fix_communities 34 | 35 | 36 | migrate_2_1_0_to_2_1_1 = UpgradeRecipe('2.1.0', '2.1.1') 37 | 38 | # We updated the elasticsearch mappings 39 | for step in [elasticsearch_index_destroy, 40 | elasticsearch_index_init, 41 | elasticsearch_index_reindex, 42 | queues_declare]: 43 | migrate_2_1_0_to_2_1_1.step()(step) 44 | 45 | # There are no changes to the db schema, so no other updates are necessary 46 | -------------------------------------------------------------------------------- /webui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "b2share-webui", 3 | "private": true, 4 | "version": "0.9.0", 5 | "description": "B2SHARE web user interface", 6 | "license": "GPL-2.0", 7 | "repository": "https://github.com/EUDAT-B2SHARE/b2share.git", 8 | "scripts": { 9 | "postinstall": "./copy_files.sh", 10 | "test": "jest" 11 | }, 12 | "jest": { 13 | "modulePathIgnorePatterns": [ 14 | "common.js" 15 | ] 16 | }, 17 | "devDependencies": { 18 | "babel-core": "^6.2.1", 19 | "babel-jest": "^20.0.0", 20 | "babel-loader": "^6.2.0", 21 | "babel-preset-es2015": "^6.1.18", 22 | "babel-preset-react": "^6.1.18", 23 | "css-loader": "^0.23.0", 24 | "enzyme": "^2.8.1", 25 | "enzyme-to-json": "^1.5.1", 26 | "eslint": "^6.8.0", 27 | "eslint-plugin-react": "^7.22.0", 28 | "jest": "^20.0.0", 29 | "nightmare": "^2.10.0", 30 | "react-addons-test-utils": "^15.5.1", 31 | "style-loader": "^0.13.0", 32 | "uglify-loader": "^1.3.0", 33 | "webpack": "^1.12.14", 34 | "webpack-shell-plugin": "^0.4.2", 35 | "webpack-watch-time-plugin": "^0.1.3" 36 | }, 37 | "dependencies": { 38 | "bootstrap": "^3.3.6", 39 | "clean-webpack-plugin": "^1.0.1", 40 | "dotenv-webpack": "^1.5.7", 41 | "fast-json-patch": "^0.5.6", 42 | "font-awesome": "^4.4.0", 43 | "history": "^3.3.0", 44 | "html-webpack-plugin": "^2.30.1", 45 | "immutable": "^3.7.6", 46 | "lodash": "^4.17.20", 47 | "moment": "^2.29.1", 48 | "piwik-react-router": "^0.12.1", 49 | "pluralize": "^1.2.1", 50 | "react": "^15.7.0", 51 | "react-addons-shallow-compare": "^15.6.3", 52 | "react-bootstrap": "^0.31.3", 53 | "react-dom": "^15.7.0", 54 | "react-piwik": "^1.11.0", 55 | "react-share": "^2.4.0", 56 | "react-router": "^2.1.1", 57 | "react-toggle": "^2.2.0", 58 | "react-widgets": "^3.2.4", 59 | "reqwest": "^2.0.5" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tests/b2share_unit_tests/records/test_records_utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Test B2Share record module utils.""" 25 | 26 | from b2share_unit_tests.helpers import create_deposit 27 | from b2share.modules.records.utils import is_publication, is_deposit 28 | from b2share_unit_tests.helpers import create_user 29 | 30 | def test_records_type_helpers(app, test_records_data): 31 | """Test record util functions retrieving the record type.""" 32 | with app.app_context(): 33 | creator = create_user('creator') 34 | deposit = create_deposit(test_records_data[0], creator) 35 | deposit.submit() 36 | deposit.publish() 37 | _, record = deposit.fetch_published() 38 | assert is_deposit(deposit.model) 39 | assert not is_deposit(record.model) 40 | assert is_publication(record.model) 41 | assert not is_publication(deposit.model) 42 | -------------------------------------------------------------------------------- /b2share/modules/access/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2share access module extension.""" 25 | 26 | from .loader import register_permissions_loader 27 | # FIXME: this is only needed because we don't use oauth2server's 28 | # server blueprint. Remove this once we integrate it. 29 | from invenio_oauth2server.views.server import login_oauth2_user 30 | 31 | 32 | class B2ShareAccess(object): 33 | """B2Share Records extension.""" 34 | 35 | def __init__(self, app=None): 36 | """Extension initialization.""" 37 | if app: 38 | self.init_app(app) 39 | 40 | def init_app(self, app): 41 | """Flask application initialization.""" 42 | self.init_config(app) 43 | app.extensions['b2share-access'] = self 44 | register_permissions_loader(app) 45 | 46 | 47 | def init_config(self, app): 48 | """Initialize configuration.""" 49 | pass 50 | -------------------------------------------------------------------------------- /tests/b2share_unit_tests/b2stats/test_b2stats_api.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2023 CSC - IT Center for Science Ltd. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """Test B2Share Statistics Collection Endpoint.""" 21 | 22 | from flask import url_for 23 | 24 | 25 | def test_b2share_stats_permissions(app, login_user, test_users): 26 | """Test B2shareStatistics API collection point authorization.""" 27 | 28 | with app.app_context(): 29 | b2stats_url = url_for('b2share_statistics.b2share_statistics') 30 | 31 | def test_access(status, user=None): 32 | with app.test_client() as client: 33 | if user is not None: 34 | login_user(user, client) 35 | # try accessing the record 36 | request_res = client.get(b2stats_url, query_string="query=quota", data="{}") 37 | print(request_res) 38 | assert request_res.status_code == status 39 | 40 | user = test_users['normal'] 41 | admin = test_users['admin'] 42 | 43 | test_access(403) # anonymous user 44 | test_access(403,user) 45 | test_access(200,admin) 46 | -------------------------------------------------------------------------------- /b2share/modules/files/storage.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2share Storage Class.""" 25 | 26 | from flask import make_response 27 | from invenio_files_rest.storage.pyfs import PyFSFileStorage, \ 28 | pyfs_storage_factory 29 | 30 | 31 | class B2ShareFileStorage(PyFSFileStorage): 32 | """Class for B2Share file storage interface to files.""" 33 | def send_file(self, filename, mimetype=None, restricted=True, 34 | checksum=None, trusted=False, chunk_size=None): 35 | """Redirect to the actual pid of the file.""" 36 | headers = [('Location', self.fileurl)] 37 | return make_response(("Found", 302, headers)) 38 | 39 | 40 | def b2share_storage_factory(**kwargs): 41 | """Pass B2ShareFileStorage as parameter to pyfs_storage_factory.""" 42 | if kwargs['fileinstance'].storage_class == 'B': 43 | kwargs['filestorage_class'] = B2ShareFileStorage 44 | return pyfs_storage_factory(**kwargs) 45 | -------------------------------------------------------------------------------- /b2share/modules/stats/event_builders.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 CERN. 5 | # Copyright (C) 2023 CSC 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """Statistics event builders.""" 22 | 23 | import datetime 24 | from invenio_stats.utils import get_user 25 | from b2share.modules.records.utils import is_deposit 26 | 27 | def get_id(rec): 28 | pid = '' 29 | for i in rec.get("_pid", []): 30 | if i.get('type') == 'b2rec': 31 | pid = i.get('value') 32 | return pid 33 | 34 | def record_view_event_builder(event, sender_app, pid=None, record=None, 35 | **kwargs): 36 | """Build a record-view event.""" 37 | if not record: 38 | return event 39 | if record.get('$schema', '').endswith('#/draft_json_schema'): 40 | return None 41 | event.update(dict( 42 | # When: 43 | timestamp=datetime.datetime.utcnow().isoformat(), 44 | # What: 45 | record_id=str(get_id(record)), 46 | pid_type=pid.pid_type, 47 | pid_value=str(pid.pid_value), 48 | unique_id = '{0}_{1}'.format(pid.pid_type, pid.pid_value), 49 | community=record['community'], 50 | # Who: 51 | **get_user() 52 | )) 53 | return event 54 | -------------------------------------------------------------------------------- /b2share/modules/remotes/errors.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """error class(es) for remotes""" 25 | 26 | 27 | from invenio_rest.errors import RESTException, FieldError 28 | 29 | 30 | class UserError(RESTException): 31 | code = 400 32 | 33 | def __init__(self, description): 34 | super(UserError, self).__init__(description=description) 35 | 36 | 37 | class ConnectionError(RESTException): 38 | code = 502 39 | 40 | def __init__(self, description): 41 | super(ConnectionError, self).__init__(description=description) 42 | 43 | 44 | class RemoteError(RESTException): 45 | code = 502 46 | 47 | def __init__(self, description): 48 | super(RemoteError, self).__init__(description=description) 49 | 50 | @classmethod 51 | def from_webdav(cls, error): 52 | if error.actual_code == 401: 53 | return cls("Remote service authentication error") 54 | return cls("Remote service operation error") 55 | -------------------------------------------------------------------------------- /b2share/modules/files/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 CERN. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2share records extension""" 25 | 26 | from __future__ import absolute_import, print_function 27 | 28 | from .cli import files as files_cmd 29 | from .views import object_view_object_resources 30 | 31 | class B2ShareFiles(object): 32 | """B2Share Files extension.""" 33 | 34 | def __init__(self, app=None): 35 | """Extension initialization.""" 36 | if app: 37 | self.init_app(app) 38 | 39 | def init_app(self, app): 40 | """Flask application initialization.""" 41 | self.init_config(app) 42 | app.cli.add_command(files_cmd) 43 | app.extensions['b2share-files-rest'] = self 44 | @app.before_first_request 45 | def replace_files_rest_object_view(): 46 | app.view_functions['invenio_files_rest.object_api'] = object_view_object_resources 47 | 48 | 49 | def init_config(self, app): 50 | """Initialize configuration.""" 51 | pass 52 | -------------------------------------------------------------------------------- /b2share/modules/roles/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """B2SHARE module providing access to user accounts 22 | 23 | 24 | B2SHARE is accessible to anonymous users (not authenticated). However some 25 | actions can only be performed by authenticated users. 26 | 27 | Invenio provides the ``invenio-accounts`` module which stores in the database 28 | user account information. 29 | 30 | The B2SHARE module ``b2share.modules.users`` adds some features on top of 31 | ``invenio-accounts``. 32 | 33 | * A REST API enabling to read user information and to create **REST API Access 34 | Tokens**. See ``b2share.modules.users.views``. 35 | 36 | * Permission classes limiting the access to the REST API. See the 37 | ``b2share.modules.users.permissions`` module. 38 | 39 | REST API Access Tokens enable a user to send authenticated requests via the 40 | REST API. Example: ``GET /api/user/?access_token=``. See 41 | ``invenio-oauth2server`` for more information on Access Tokens. 42 | """ 43 | 44 | from __future__ import absolute_import, print_function 45 | 46 | from .ext import B2ShareRoles 47 | 48 | __all__ = ('B2ShareRoles') 49 | -------------------------------------------------------------------------------- /b2share/modules/users/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """B2SHARE module providing access to user accounts 22 | 23 | 24 | B2SHARE is accessible to anonymous users (not authenticated). However some 25 | actions can only be performed by authenticated users. 26 | 27 | Invenio provides the ``invenio-accounts`` module which stores in the database 28 | user account information. 29 | 30 | The B2SHARE module ``b2share.modules.users`` adds some features on top of 31 | ``invenio-accounts``. 32 | 33 | * A REST API enabling to read user information and to create **REST API Access 34 | Tokens**. See ``b2share.modules.users.views``. 35 | 36 | * Permission classes limiting the access to the REST API. See the 37 | ``b2share.modules.users.permissions`` module. 38 | 39 | REST API Access Tokens enable a user to send authenticated requests via the 40 | REST API. Example: ``GET /api/user/?access_token=``. See 41 | ``invenio-oauth2server`` for more information on Access Tokens. 42 | """ 43 | 44 | from __future__ import absolute_import, print_function 45 | 46 | from .ext import B2ShareUsers 47 | 48 | __all__ = ('B2ShareUsers') 49 | -------------------------------------------------------------------------------- /b2share/modules/roles/cli.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 University of Tübingen, CERN 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share cli commands for roles.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import click 30 | from flask.cli import with_appcontext 31 | 32 | from invenio_accounts.cli import roles 33 | from invenio_accounts.models import Role, User 34 | 35 | @roles.command('list') 36 | @click.argument('user', required=False) 37 | @with_appcontext 38 | def roles_list(user): 39 | """List all known roles (for a user)""" 40 | 41 | if user: 42 | userdata = User.query.filter(User.email == user).order_by(User.id) 43 | else: 44 | userdata = User.query.order_by(User.id) 45 | 46 | click.secho("ID\tACTIVE\tEMAIL\t\t\t\t\tROLES") 47 | for u in userdata: 48 | click.secho("%s\t%s\t%s\t\t\t%s" % ( 49 | u.id, 50 | u.active, 51 | u.email, 52 | list(map(lambda x: x.description, u.roles if len(u.roles) else [])) 53 | )) 54 | -------------------------------------------------------------------------------- /tests/b2share_unit_tests/apiroot/test_apiroot_rest.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016, University of Tuebingen. 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """Test B2Share apiroot module.""" 25 | 26 | import json 27 | 28 | from flask import url_for 29 | from b2share import __version__ 30 | 31 | 32 | def test_info_get(app): 33 | headers = [('Content-Type', 'application/json'), 34 | ('Accept', 'application/json')] 35 | 36 | def get_info(): 37 | req = client.get(url_for('b2share_apiroot.info'), headers=headers) 38 | assert req.status_code == 200 39 | return json.loads(req.get_data(as_text=True)) 40 | 41 | with app.app_context(): 42 | with app.test_client() as client: 43 | info = get_info() 44 | assert info['site_function'] == app.config.get("SITE_FUNCTION") 45 | assert info['training_site_link'] == app.config.get("TRAINING_SITE_LINK") 46 | assert info['production_site_link'] == app.config.get("PRODCUTION_SITE_LINK") 47 | assert info['version'] == __version__ 48 | -------------------------------------------------------------------------------- /b2share/modules/roles/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """B2share users extension""" 22 | 23 | from __future__ import absolute_import, print_function 24 | from werkzeug.utils import cached_property 25 | from .cli import roles as roles_cmd 26 | from flask import Blueprint 27 | 28 | 29 | class _B2ShareRolesState(object): 30 | """B2Share users extension state.""" 31 | 32 | def __init__(self, app): 33 | """Constructor. 34 | 35 | Args: 36 | app: the Flask application. 37 | """ 38 | self.app = app 39 | 40 | 41 | class B2ShareRoles(object): 42 | """B2Share Roles extension.""" 43 | 44 | def __init__(self, app=None): 45 | """Extension initialization.""" 46 | if app: 47 | self.init_app(app) 48 | 49 | def init_app(self, app): 50 | """Flask application initialization.""" 51 | self.init_config(app) 52 | app.cli.add_command(roles_cmd) 53 | blueprint = Blueprint('roles', __name__) 54 | app.register_blueprint(blueprint) 55 | app.extensions['b2share-roles'] = _B2ShareRolesState(app) 56 | 57 | def init_config(self, app): 58 | pass -------------------------------------------------------------------------------- /b2share/modules/deposit/cli.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 University of Tübingen, CERN 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | # 20 | # In applying this license, CERN does not 21 | # waive the privileges and immunities granted to it by virtue of its status 22 | # as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | """B2Share cli commands for deposits.""" 25 | 26 | 27 | from __future__ import absolute_import, print_function 28 | 29 | import click 30 | from flask.cli import with_appcontext 31 | from flask import current_app 32 | import requests 33 | 34 | from invenio_db import db 35 | from invenio_deposit.cli import deposit 36 | 37 | from b2share.modules.deposit.utils import delete_deposit 38 | 39 | 40 | @deposit.command('delete') 41 | @with_appcontext 42 | @click.argument('deposit-pid', required=True, type=str) 43 | def delete(deposit_pid): 44 | """ Delete unpublished deposit given the deposit id. 45 | 46 | :params deposit-pid: deposit id 47 | """ 48 | try: 49 | delete_deposit(deposit_pid) 50 | db.session.commit() 51 | click.secho("deposit <{}> deleted from db".format(deposit_pid)) 52 | except: 53 | raise click.ClickException("It is not possible to delete deposit_pid: {}".format(deposit_pid)) 54 | 55 | 56 | -------------------------------------------------------------------------------- /b2share/modules/management/ownership/ext.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2016 University of Tuebingen, CERN. 5 | # Copyright (C) 2015 University of Tuebingen. 6 | # 7 | # B2Share is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU General Public License as 9 | # published by the Free Software Foundation; either version 2 of the 10 | # License, or (at your option) any later version. 11 | # 12 | # B2Share is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 19 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | """B2share ownership extension""" 22 | 23 | from __future__ import absolute_import, print_function 24 | 25 | from werkzeug.utils import cached_property 26 | 27 | from .views import blueprint 28 | 29 | from .cli import ownership as ownership_cmd 30 | 31 | 32 | class _B2ShareOwnership(object): 33 | """B2Share users extension state.""" 34 | 35 | def __init__(self, app): 36 | """Constructor. 37 | 38 | Args: 39 | app: the Flask application. 40 | """ 41 | self.app = app 42 | 43 | 44 | class B2ShareOwnership(object): 45 | """B2Share Ownership extension.""" 46 | 47 | def __init__(self, app=None): 48 | """Extension initialization.""" 49 | if app: 50 | self.init_app(app) 51 | 52 | def init_app(self, app): 53 | """Flask application initialization.""" 54 | self.init_config(app) 55 | app.cli.add_command(ownership_cmd) 56 | app.extensions['b2share-ownership'] = _B2ShareOwnership(app) 57 | app.register_blueprint(blueprint) 58 | 59 | def init_config(self, app): 60 | pass 61 | -------------------------------------------------------------------------------- /tests/b2share_unit_tests/deposit/test_deposit_cli.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # This file is part of EUDAT B2Share. 4 | # Copyright (C) 2017 SurfSara, University of Tübingen 5 | # 6 | # B2Share is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU General Public License as 8 | # published by the Free Software Foundation; either version 2 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # B2Share is distributed in the hope that it will be useful, but 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | # General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with B2Share; if not, write to the Free Software Foundation, Inc., 18 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 19 | 20 | """Test B2Share deposit cli module.""" 21 | from __future__ import absolute_import, print_function 22 | 23 | 24 | from click.testing import CliRunner 25 | from flask.cli import ScriptInfo 26 | import pytest 27 | 28 | import b2share.modules.deposit.cli as deposit_cli 29 | from b2share.modules.deposit.api import Deposit 30 | 31 | 32 | def test_deposit_delete(app, draft_deposits): 33 | """Test deposit remove of unpublished deposit.""" 34 | data = draft_deposits[0] 35 | 36 | with app.app_context(): 37 | # get the deposit, check if this exist 38 | deposit = Deposit.get_record(data.deposit_id) 39 | 40 | runner = CliRunner() 41 | script_info = ScriptInfo(create_app=lambda info: app) 42 | with app.app_context(): 43 | # delete the deposit 44 | result = runner.invoke(deposit_cli.delete, [str(deposit.id)], obj=script_info) 45 | if result.exit_code != 0: 46 | print(result.output) 47 | assert result.exit_code == 0 48 | 49 | # check if the deposit does not exist anymore. 50 | # if does not fail the test fails! 51 | with pytest.raises(Exception): 52 | deposit=Deposit.get_record(data.deposit_id) 53 | 54 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.json 2 | include *.py 3 | include *.rst 4 | include *.txt 5 | include *.yml 6 | include .bowerrc 7 | include .dockerignore 8 | include ABOUT-NLS 9 | include AUTHORS 10 | include COPYING 11 | include ChangeLog 12 | include Dockerfile 13 | include NEWS 14 | include Procfile* 15 | include RELEASE-NOTES 16 | include THANKS 17 | include TODO 18 | include UNINSTALL 19 | include babel.cfg 20 | include mapping.cfg 21 | include requirements*.txt 22 | 23 | recursive-include docs * 24 | recursive-exclude docs/_build * 25 | 26 | recursive-include invenio *.bfo 27 | recursive-include invenio *.bft 28 | recursive-include invenio *.cfg 29 | recursive-include invenio *.dat 30 | recursive-include invenio *.dia 31 | recursive-include invenio *.dtd 32 | recursive-include invenio *.edited 33 | recursive-include invenio *.html 34 | recursive-include invenio *.in 35 | recursive-include invenio *.java 36 | recursive-include invenio *.jpeg 37 | recursive-include invenio *.js 38 | recursive-include invenio *.json 39 | recursive-include invenio *.kb 40 | recursive-include invenio *.lisp 41 | recursive-include invenio *.lua 42 | recursive-include invenio *.png 43 | recursive-include invenio *.ps 44 | recursive-include invenio *.py 45 | recursive-include invenio *.sql 46 | recursive-include invenio *.tex 47 | recursive-include invenio *.txt 48 | recursive-include invenio *.wsgi 49 | recursive-include invenio *.xml 50 | recursive-include invenio *.xsd 51 | recursive-include invenio *.xsl 52 | recursive-include invenio *.yml 53 | 54 | recursive-include invenio/base/static * 55 | recursive-include invenio/base/templates * 56 | recursive-include invenio/base/translations *.mo *.po *.pot 57 | 58 | recursive-include invenio/legacy *.webdoc 59 | recursive-include invenio/legacy/miscutil/solrutils *.java 60 | 61 | recursive-include invenio/modules/*/static * 62 | recursive-include invenio/modules/*/templates * 63 | recursive-include invenio/modules/*/testsuite * 64 | recursive-include invenio/modules/*/translations *.mo *.po *.pot 65 | 66 | recursive-include invenio/testsuite * 67 | 68 | recursive-include scripts *.sh 69 | 70 | recursive-exclude * *.py[co] 71 | recursive-exclude * *.php 72 | -------------------------------------------------------------------------------- /webui/src/components/animate.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react/lib/ReactWithAddons'; 2 | const ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; 3 | 4 | 5 | export const ReplaceAnimate = React.createClass({ 6 | render() { 7 | const delta = 100; 8 | return (
{ this.props.children }
); 9 | // return ( 10 | // 13 | 14 | // 15 | // ); 16 | } 17 | }); 18 | 19 | export const ListAnimate = React.createClass({ 20 | render() { 21 | const delta = 1000; 22 | return ( 23 | 26 | { this.props.children } 27 | 28 | ); 29 | } 30 | }); 31 | 32 | export const HeightAnimate = React.createClass({ 33 | getInitialState() { 34 | return { 35 | height: 0, 36 | } 37 | }, 38 | 39 | onHeight() { 40 | const h = + (this.wrapper ? this.wrapper.clientHeight : 0) 41 | + (this.props.delta || 0); 42 | if (h != this.state.height) { 43 | this.setState({height: h}); 44 | } 45 | }, 46 | 47 | componentDidMount() { 48 | this.onHeight(); 49 | }, 50 | 51 | componentDidUpdate() { 52 | this.onHeight(); 53 | }, 54 | 55 | render() { 56 | return ( 57 |
58 |
this.wrapper = el} style={{margin:0, padding:0}}> 59 | { this.props.children } 60 |
61 |
62 | ); 63 | } 64 | }); 65 | -------------------------------------------------------------------------------- /demo/README.rst: -------------------------------------------------------------------------------- 1 | .. 2 | This file is part of B2Share. 3 | Copyright (C) 2016 CERN. 4 | 5 | B2Share is free software; you can redistribute it 6 | and/or modify it under the terms of the GNU General Public License as 7 | published by the Free Software Foundation; either version 2 of the 8 | License, or (at your option) any later version. 9 | 10 | B2Share is distributed in the hope that it will be 11 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with B2Share; if not, write to the 17 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 18 | MA 02111-1307, USA. 19 | 20 | In applying this license, CERN does not 21 | waive the privileges and immunities granted to it by virtue of its status 22 | as an Intergovernmental Organization or submit itself to any jurisdiction. 23 | 24 | ====================== 25 | B2Share Demonstration 26 | ====================== 27 | 28 | This file describes how to install and use this B2Share demonstration. 29 | 30 | Prerequisites 31 | ============= 32 | 33 | This demonstration module needs b2share to be installed. 34 | 35 | The database must be initalized. Run these commands if this is not the case. 36 | 37 | .. code-block:: console 38 | $ # Run these commands in b2share directory. 39 | $ b2share db init 40 | $ b2share db create 41 | 42 | Demonstration Installation 43 | ========================== 44 | 45 | .. code-block:: console 46 | $ # Run this command in b2share/demo directory. 47 | $ pip install -e . 48 | 49 | Now the b2share command has been extended and we can load the demo. 50 | 51 | .. code-block:: console 52 | $ # Run this command in b2share/demo directory. 53 | $ # load the demo data 54 | $ b2share demo load 55 | 56 | Demonstration usage 57 | =================== 58 | 59 | The B2Share command works as before. You can just run the application. 60 | 61 | .. code-block:: console 62 | $ b2share run 63 | -------------------------------------------------------------------------------- /b2share/modules/stats/record_view/record-view-v1.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "events-stats-record-view-*", 3 | "settings": { 4 | "index": { 5 | "refresh_interval": "5s" 6 | } 7 | }, 8 | "mappings": { 9 | "_default_": { 10 | "dynamic_templates": [ 11 | { 12 | "date_fields": { 13 | "match_mapping_type": "date", 14 | "mapping": { 15 | "type": "date", 16 | "format": "strict_date_hour_minute_second" 17 | } 18 | } 19 | } 20 | ] 21 | }, 22 | "record-view": { 23 | "_source": { 24 | "enabled": false 25 | }, 26 | "_all": { 27 | "enabled": false 28 | }, 29 | "date_detection": false, 30 | "numeric_detection": false, 31 | "properties": { 32 | "timestamp": { 33 | "type": "date", 34 | "format": "strict_date_hour_minute_second" 35 | }, 36 | "record_id": { 37 | "type": "string", 38 | "index": "not_analyzed" 39 | }, 40 | "pid_type": { 41 | "type": "string", 42 | "index": "not_analyzed" 43 | }, 44 | "pid_value": { 45 | "type": "string", 46 | "index": "not_analyzed" 47 | }, 48 | "labels": { 49 | "type": "string", 50 | "index": "not_analyzed" 51 | }, 52 | "country": { 53 | "type": "string", 54 | "index": "not_analyzed" 55 | }, 56 | "visitor_id": { 57 | "type": "string", 58 | "index": "not_analyzed" 59 | } 60 | } 61 | } 62 | }, 63 | "aliases": { 64 | "events-stats-record-view": {} 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /webui/src/components/selectlicense.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react/lib/ReactWithAddons'; 2 | 3 | const PT = React.PropTypes; 4 | 5 | export const SelectLicense = React.createClass({ 6 | propTypes: { 7 | title: PT.string.isRequired, 8 | onSelect: PT.func.isRequired, 9 | setModal: PT.func.isRequired, 10 | }, 11 | 12 | onReceiveMessage(event) { 13 | var origin = event.origin || event.originalEvent.origin; 14 | if (origin === window.location.origin) { 15 | this.props.setModal(false); 16 | if (event.data) { 17 | const licenseData = { 18 | 'license': event.data.name, 19 | 'license_uri': event.data.url, 20 | 'license_identifier': event.data.key, 21 | 'scheme': event.data.scheme, 22 | 'scheme_uri': event.data.schemeUri 23 | }; 24 | this.props.onSelect(licenseData); 25 | } 26 | } 27 | }, 28 | 29 | componentWillMount() { 30 | window.addEventListener("message", this.onReceiveMessage, false); 31 | }, 32 | 33 | componentWillUnmount() { 34 | window.removeEventListener("message", this.onReceiveMessage); 35 | }, 36 | 37 | render(type, getValue, setValue, title) { 38 | const licenseModal =