From db2e4544619a6108f0bb0a811c3c390d912b9fa4 Mon Sep 17 00:00:00 2001 From: Sotiris Tsepelakis <sotirios.tsepelakis@tuwien.ac.at> Date: Mon, 25 Nov 2024 18:57:11 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=8C=20Deps:=20pin=20flask-menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index f94c9bb..cad74f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ dependencies = [ "Invenio-Search>=2.1.0,<3.0.0", "Flask>=2.0.2", "Flask-Minify>=0.47", + "Flask-Menu<2.0.0", ] [project.optional-dependencies] -- GitLab From 99efe490dff1841a5c26b428321e05dc75fb8d50 Mon Sep 17 00:00:00 2001 From: Sotiris Tsepelakis <sotirios.tsepelakis@tuwien.ac.at> Date: Mon, 25 Nov 2024 23:06:21 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20Feat:=20Add=20Invenio-DAMAP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implements custom TU Wien user identity generator --- invenio_config_tuw/dmp.py | 34 ++++++++++++++++++++++++++++++++++ pyproject.toml | 1 + 2 files changed, 35 insertions(+) create mode 100644 invenio_config_tuw/dmp.py diff --git a/invenio_config_tuw/dmp.py b/invenio_config_tuw/dmp.py new file mode 100644 index 0000000..b52c95e --- /dev/null +++ b/invenio_config_tuw/dmp.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2024 TU Wien. +# +# Invenio-Config-TUW is free software; you can redistribute it and/or +# modify it under the terms of the MIT License; see LICENSE file for more +# details. + +"""Utilities for connecting InvenioRDM to DAMAP, tailored to the environment of TU Wien.""" + +from flask_principal import AnonymousIdentity + + +def tuw_id_generator(identity) -> dict[str, str]: + """ + Generates user identities mapped to namespace names specific to the TUW environment. + + Parameters: + identity: The user identity. + + Returns: + dict: Namespaces with the user identifiers. + """ + identifiers = {} + if identity and not isinstance(identity, AnonymousIdentity): + u = identity.user + + if u.email.endswith("tuwien.ac.at"): + tiss_id = u.user_profile.get("tiss_id") + + if tiss_id: + identifiers["tiss_id"] = tiss_id + + return identifiers diff --git a/pyproject.toml b/pyproject.toml index cad74f9..b0ca2a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ dependencies = [ "Flask>=2.0.2", "Flask-Minify>=0.47", "Flask-Menu<2.0.0", + "Invenio-DAMAP>=0.1.1" ] [project.optional-dependencies] -- GitLab From 86efb6840ffa893998ef94920e23a61e5c59e6d1 Mon Sep 17 00:00:00 2001 From: Sotiris Tsepelakis <sotirios.tsepelakis@tuwien.ac.at> Date: Tue, 26 Nov 2024 11:39:54 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=93=A6=20Release:=20v2024.4.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.rst | 7 +++++++ invenio_config_tuw/__init__.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index c18329b..445871a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,13 @@ Changes ======= +Version 2024.4 (released 2024-11-26) + +- Pin `Flask-Menu`` dependency +- Add `Invenio-DAMAP` to the dependencies +- Implement TU Wien user identity generator for connection to DAMAP + + Version 2024.3 (released 2024-10-01, updated 2024-11-13) - Replace `setuptools` with `hatchling` as build tool diff --git a/invenio_config_tuw/__init__.py b/invenio_config_tuw/__init__.py index b46a673..b8ca5a3 100644 --- a/invenio_config_tuw/__init__.py +++ b/invenio_config_tuw/__init__.py @@ -9,6 +9,6 @@ from .ext import InvenioConfigTUW -__version__ = "2024.3.2" +__version__ = "2024.4.0" __all__ = ("__version__", "InvenioConfigTUW") -- GitLab