*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Verified Commit 99efe490 authored by Tsepelakis, Sotirios's avatar Tsepelakis, Sotirios :dart:
Browse files

:sparkles: Feat: Add Invenio-DAMAP

* Implements custom TU Wien user identity generator
parent db2e4544
No related branches found
No related tags found
1 merge request!71📦 Release: v2024.4.0
# -*- 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
......@@ -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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment