diff --git a/LICENSE b/LICENSE index b06b3d39e..a3ab71021 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2022 CRS4 +Copyright (c) 2020-2024 CRS4 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/app.py b/app.py index 8e5dfe17c..c3064912f 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/cli/admin.py b/cli/admin.py index a3be519e7..bb188ecc8 100755 --- a/cli/admin.py +++ b/cli/admin.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/cli/client/__init__.py b/cli/client/__init__.py index a8f545d09..3c65281b9 100644 --- a/cli/client/__init__.py +++ b/cli/client/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/cli/client/issues.py b/cli/client/issues.py index 71a24a141..5154ea072 100644 --- a/cli/client/issues.py +++ b/cli/client/issues.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/cli/client/main.py b/cli/client/main.py index 174b5fd12..e1633beb2 100644 --- a/cli/client/main.py +++ b/cli/client/main.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/cli/client/utils.py b/cli/client/utils.py index 8a5318930..1226be80a 100644 --- a/cli/client/utils.py +++ b/cli/client/utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/examples/get_workflow.py b/examples/get_workflow.py index 77372fc27..bb2331831 100644 --- a/examples/get_workflow.py +++ b/examples/get_workflow.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/gunicorn.conf.py b/gunicorn.conf.py index 8c146feb9..077b3b57d 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -1,3 +1,22 @@ +# Copyright (c) 2020-2024 CRS4 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. import os import sys diff --git a/interaction_experiments/_OLD_TEST_METADATA/check_nextflow.py b/interaction_experiments/_OLD_TEST_METADATA/check_nextflow.py index 7078bbeb9..5cdb92598 100644 --- a/interaction_experiments/_OLD_TEST_METADATA/check_nextflow.py +++ b/interaction_experiments/_OLD_TEST_METADATA/check_nextflow.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/interaction_experiments/check_cwl.py b/interaction_experiments/check_cwl.py index 851c76ba1..ccc08740e 100644 --- a/interaction_experiments/check_cwl.py +++ b/interaction_experiments/check_cwl.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/interaction_experiments/check_galaxy.py b/interaction_experiments/check_galaxy.py index a32be6ef3..a7add25b4 100644 --- a/interaction_experiments/check_galaxy.py +++ b/interaction_experiments/check_galaxy.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/k8s/Chart.yaml b/k8s/Chart.yaml index b57762557..73ea27b97 100644 --- a/k8s/Chart.yaml +++ b/k8s/Chart.yaml @@ -12,7 +12,7 @@ version: 0.11.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 0.11.9 +appVersion: 0.12.0 # Chart dependencies dependencies: diff --git a/lifemonitor/__init__.py b/lifemonitor/__init__.py index 8b51e6cd7..db8523276 100644 --- a/lifemonitor/__init__.py +++ b/lifemonitor/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/_version.py b/lifemonitor/_version.py index 7a662d603..c219d8303 100644 --- a/lifemonitor/_version.py +++ b/lifemonitor/_version.py @@ -1,3 +1,23 @@ +# Copyright (c) 2020-2024 CRS4 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build diff --git a/lifemonitor/api/__init__.py b/lifemonitor/api/__init__.py index 817e26e0e..fcf4a19c3 100644 --- a/lifemonitor/api/__init__.py +++ b/lifemonitor/api/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/controllers.py b/lifemonitor/api/controllers.py index 5cdb8887f..c0bc32c67 100644 --- a/lifemonitor/api/controllers.py +++ b/lifemonitor/api/controllers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/__init__.py b/lifemonitor/api/models/__init__.py index 576c0ea42..df9ca3f38 100644 --- a/lifemonitor/api/models/__init__.py +++ b/lifemonitor/api/models/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/issues/__init__.py b/lifemonitor/api/models/issues/__init__.py index edbb02b9c..a16672a19 100644 --- a/lifemonitor/api/models/issues/__init__.py +++ b/lifemonitor/api/models/issues/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/issues/general/experimental.py b/lifemonitor/api/models/issues/general/experimental.py index b18c12ac7..345d7b1e3 100644 --- a/lifemonitor/api/models/issues/general/experimental.py +++ b/lifemonitor/api/models/issues/general/experimental.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/issues/general/lm.py b/lifemonitor/api/models/issues/general/lm.py index 398e10118..3e219d286 100644 --- a/lifemonitor/api/models/issues/general/lm.py +++ b/lifemonitor/api/models/issues/general/lm.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/issues/general/metadata.py b/lifemonitor/api/models/issues/general/metadata.py index 05f2b3f75..ab7691a45 100644 --- a/lifemonitor/api/models/issues/general/metadata.py +++ b/lifemonitor/api/models/issues/general/metadata.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/issues/general/repo_layout.py b/lifemonitor/api/models/issues/general/repo_layout.py index d11f04560..98624d045 100644 --- a/lifemonitor/api/models/issues/general/repo_layout.py +++ b/lifemonitor/api/models/issues/general/repo_layout.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/notifications.py b/lifemonitor/api/models/notifications.py index 41bad0a26..900e773f2 100644 --- a/lifemonitor/api/models/notifications.py +++ b/lifemonitor/api/models/notifications.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/registries/__init__.py b/lifemonitor/api/models/registries/__init__.py index e2c15a7ac..24e6a0699 100644 --- a/lifemonitor/api/models/registries/__init__.py +++ b/lifemonitor/api/models/registries/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/registries/forms.py b/lifemonitor/api/models/registries/forms.py index e35840d4f..627110b7b 100644 --- a/lifemonitor/api/models/registries/forms.py +++ b/lifemonitor/api/models/registries/forms.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/registries/registry.py b/lifemonitor/api/models/registries/registry.py index 09992edd3..f5f8ca12e 100644 --- a/lifemonitor/api/models/registries/registry.py +++ b/lifemonitor/api/models/registries/registry.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/registries/seek.py b/lifemonitor/api/models/registries/seek.py index a6be8a440..d36d78291 100644 --- a/lifemonitor/api/models/registries/seek.py +++ b/lifemonitor/api/models/registries/seek.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/registries/settings.py b/lifemonitor/api/models/registries/settings.py index 449004b89..717e3cdf3 100644 --- a/lifemonitor/api/models/registries/settings.py +++ b/lifemonitor/api/models/registries/settings.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/__init__.py b/lifemonitor/api/models/repositories/__init__.py index 083b8e4f7..583144486 100644 --- a/lifemonitor/api/models/repositories/__init__.py +++ b/lifemonitor/api/models/repositories/__init__.py @@ -1,5 +1,5 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/base.py b/lifemonitor/api/models/repositories/base.py index 29648ccfe..45f39105b 100644 --- a/lifemonitor/api/models/repositories/base.py +++ b/lifemonitor/api/models/repositories/base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/config.py b/lifemonitor/api/models/repositories/config.py index 3feb57833..51fcf375f 100644 --- a/lifemonitor/api/models/repositories/config.py +++ b/lifemonitor/api/models/repositories/config.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/files/__init__.py b/lifemonitor/api/models/repositories/files/__init__.py index 4bb826d1d..652d853f8 100644 --- a/lifemonitor/api/models/repositories/files/__init__.py +++ b/lifemonitor/api/models/repositories/files/__init__.py @@ -1,3 +1,22 @@ +# Copyright (c) 2020-2024 CRS4 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. from .base import RepositoryFile from .templates import TemplateRepositoryFile diff --git a/lifemonitor/api/models/repositories/files/base.py b/lifemonitor/api/models/repositories/files/base.py index 44959379b..33ac5ffa2 100644 --- a/lifemonitor/api/models/repositories/files/base.py +++ b/lifemonitor/api/models/repositories/files/base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/files/templates.py b/lifemonitor/api/models/repositories/files/templates.py index cda3f029b..e405a45df 100644 --- a/lifemonitor/api/models/repositories/files/templates.py +++ b/lifemonitor/api/models/repositories/files/templates.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/files/workflows/__init__.py b/lifemonitor/api/models/repositories/files/workflows/__init__.py index ce5876a97..6f761cfc0 100644 --- a/lifemonitor/api/models/repositories/files/workflows/__init__.py +++ b/lifemonitor/api/models/repositories/files/workflows/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/files/workflows/galaxy.py b/lifemonitor/api/models/repositories/files/workflows/galaxy.py index 7e43867b2..3bcde7eb5 100644 --- a/lifemonitor/api/models/repositories/files/workflows/galaxy.py +++ b/lifemonitor/api/models/repositories/files/workflows/galaxy.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/files/workflows/jupyter.py b/lifemonitor/api/models/repositories/files/workflows/jupyter.py index 0e92bf2da..fcc1c09cf 100644 --- a/lifemonitor/api/models/repositories/files/workflows/jupyter.py +++ b/lifemonitor/api/models/repositories/files/workflows/jupyter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/files/workflows/nextflow.py b/lifemonitor/api/models/repositories/files/workflows/nextflow.py index 7ad8ee6c1..5f83baea3 100644 --- a/lifemonitor/api/models/repositories/files/workflows/nextflow.py +++ b/lifemonitor/api/models/repositories/files/workflows/nextflow.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/files/workflows/other.py b/lifemonitor/api/models/repositories/files/workflows/other.py index 9a4139dcb..22435a6cb 100644 --- a/lifemonitor/api/models/repositories/files/workflows/other.py +++ b/lifemonitor/api/models/repositories/files/workflows/other.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/files/workflows/snakemake.py b/lifemonitor/api/models/repositories/files/workflows/snakemake.py index 09c7e5462..1f3f3fdff 100644 --- a/lifemonitor/api/models/repositories/files/workflows/snakemake.py +++ b/lifemonitor/api/models/repositories/files/workflows/snakemake.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/github.py b/lifemonitor/api/models/repositories/github.py index 6d88496d1..130a2de0e 100644 --- a/lifemonitor/api/models/repositories/github.py +++ b/lifemonitor/api/models/repositories/github.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/local.py b/lifemonitor/api/models/repositories/local.py index e7595de26..6a8e9d2a5 100644 --- a/lifemonitor/api/models/repositories/local.py +++ b/lifemonitor/api/models/repositories/local.py @@ -1,5 +1,5 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/templates/__init__.py b/lifemonitor/api/models/repositories/templates/__init__.py index 9c12d5a40..345a4297f 100644 --- a/lifemonitor/api/models/repositories/templates/__init__.py +++ b/lifemonitor/api/models/repositories/templates/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/templates/galaxy.py b/lifemonitor/api/models/repositories/templates/galaxy.py index 24286fa16..adfc75817 100644 --- a/lifemonitor/api/models/repositories/templates/galaxy.py +++ b/lifemonitor/api/models/repositories/templates/galaxy.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/templates/nextflow.py b/lifemonitor/api/models/repositories/templates/nextflow.py index 1f28d58de..4550eff80 100644 --- a/lifemonitor/api/models/repositories/templates/nextflow.py +++ b/lifemonitor/api/models/repositories/templates/nextflow.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/repositories/templates/snakemake.py b/lifemonitor/api/models/repositories/templates/snakemake.py index 4a4d04ae3..992a4e662 100644 --- a/lifemonitor/api/models/repositories/templates/snakemake.py +++ b/lifemonitor/api/models/repositories/templates/snakemake.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/rocrate/__init__.py b/lifemonitor/api/models/rocrate/__init__.py index 85b3170e1..f5e4f6666 100644 --- a/lifemonitor/api/models/rocrate/__init__.py +++ b/lifemonitor/api/models/rocrate/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/rocrate/generators.py b/lifemonitor/api/models/rocrate/generators.py index 2f83196b9..1dcd3b4c7 100644 --- a/lifemonitor/api/models/rocrate/generators.py +++ b/lifemonitor/api/models/rocrate/generators.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/services/__init__.py b/lifemonitor/api/models/services/__init__.py index 99d5f973a..94c88922c 100644 --- a/lifemonitor/api/models/services/__init__.py +++ b/lifemonitor/api/models/services/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/services/github.py b/lifemonitor/api/models/services/github.py index 96a2f2830..93331d059 100644 --- a/lifemonitor/api/models/services/github.py +++ b/lifemonitor/api/models/services/github.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/services/jenkins.py b/lifemonitor/api/models/services/jenkins.py index 11285a982..0ca1479ac 100644 --- a/lifemonitor/api/models/services/jenkins.py +++ b/lifemonitor/api/models/services/jenkins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/services/service.py b/lifemonitor/api/models/services/service.py index 0a84d5a39..99af9811d 100644 --- a/lifemonitor/api/models/services/service.py +++ b/lifemonitor/api/models/services/service.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/services/travis.py b/lifemonitor/api/models/services/travis.py index 28946e2f3..7a593527c 100644 --- a/lifemonitor/api/models/services/travis.py +++ b/lifemonitor/api/models/services/travis.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/status.py b/lifemonitor/api/models/status.py index f401b9055..8b0a9a062 100644 --- a/lifemonitor/api/models/status.py +++ b/lifemonitor/api/models/status.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/testsuites/__init__.py b/lifemonitor/api/models/testsuites/__init__.py index d95632f4c..ea1672ccf 100644 --- a/lifemonitor/api/models/testsuites/__init__.py +++ b/lifemonitor/api/models/testsuites/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/testsuites/testbuild.py b/lifemonitor/api/models/testsuites/testbuild.py index e176f1de0..cb666310d 100644 --- a/lifemonitor/api/models/testsuites/testbuild.py +++ b/lifemonitor/api/models/testsuites/testbuild.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/testsuites/testinstance.py b/lifemonitor/api/models/testsuites/testinstance.py index 990946050..f54741281 100644 --- a/lifemonitor/api/models/testsuites/testinstance.py +++ b/lifemonitor/api/models/testsuites/testinstance.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/testsuites/testsuite.py b/lifemonitor/api/models/testsuites/testsuite.py index 75fb71ebe..a26b79e4c 100644 --- a/lifemonitor/api/models/testsuites/testsuite.py +++ b/lifemonitor/api/models/testsuites/testsuite.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/wizards/__init__.py b/lifemonitor/api/models/wizards/__init__.py index e693f8866..6bccb88e7 100644 --- a/lifemonitor/api/models/wizards/__init__.py +++ b/lifemonitor/api/models/wizards/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/wizards/repository_template.py b/lifemonitor/api/models/wizards/repository_template.py index 277f86879..53a856785 100644 --- a/lifemonitor/api/models/wizards/repository_template.py +++ b/lifemonitor/api/models/wizards/repository_template.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/models/workflows.py b/lifemonitor/api/models/workflows.py index 7b213e22d..a27b189ac 100644 --- a/lifemonitor/api/models/workflows.py +++ b/lifemonitor/api/models/workflows.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/serializers.py b/lifemonitor/api/serializers.py index c7d81ebf5..707f0d4f7 100644 --- a/lifemonitor/api/serializers.py +++ b/lifemonitor/api/serializers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/api/services.py b/lifemonitor/api/services.py index 2f7f71910..3c96094bd 100644 --- a/lifemonitor/api/services.py +++ b/lifemonitor/api/services.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/app.py b/lifemonitor/app.py index c61f10aef..3a150e4aa 100644 --- a/lifemonitor/app.py +++ b/lifemonitor/app.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/__init__.py b/lifemonitor/auth/__init__.py index c6b66cfd1..2153a43c5 100644 --- a/lifemonitor/auth/__init__.py +++ b/lifemonitor/auth/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/controllers.py b/lifemonitor/auth/controllers.py index e1550a82a..45de399af 100644 --- a/lifemonitor/auth/controllers.py +++ b/lifemonitor/auth/controllers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -28,6 +28,7 @@ from flask_login import login_required, login_user, logout_user from wtforms import ValidationError +from lifemonitor.auth.oauth2.client.models import OAuth2IdentityProvider from lifemonitor.cache import Timeout, cached, clear_cache from lifemonitor.utils import (NextRouteRegistry, next_route_aware, split_by_crlf) @@ -191,7 +192,17 @@ def profile(form=None, passwordForm=None, currentView=None, logger.debug("detected back param: %s", back_param) from lifemonitor.api.models.registries.forms import RegistrySettingsForm from lifemonitor.integrations.github.forms import GithubSettingsForm - logger.warning("Request args: %r", request.args) + logger.debug("Request args: %r", request.args) + logger.debug("Providers: %r", get_providers()) + logger.debug("Current user: %r", current_user) + user_identities = [{ + "name": p.name, + "identity": current_user.oauth_identity.get(p.client_name, None) + if current_user and current_user.is_authenticated else None, + "provider": p + } for p in OAuth2IdentityProvider.all() + ] + logger.debug("User identities: %r", user_identities) return render_template("auth/profile.j2", passwordForm=passwordForm or SetPasswordForm(), emailForm=emailForm or EmailForm(), @@ -204,6 +215,7 @@ def profile(form=None, passwordForm=None, currentView=None, providers=get_providers(), currentView=currentView, oauth2_generic_client_scopes=OpenApiSpecs.get_instance().authorization_code_scopes, api_base_url=get_external_server_url(), + user_identities=user_identities, back_param=back_param) diff --git a/lifemonitor/auth/forms.py b/lifemonitor/auth/forms.py index 3a162f247..9a819526f 100644 --- a/lifemonitor/auth/forms.py +++ b/lifemonitor/auth/forms.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/models.py b/lifemonitor/auth/models.py index 4b3016416..ec4283812 100644 --- a/lifemonitor/auth/models.py +++ b/lifemonitor/auth/models.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/__init__.py b/lifemonitor/auth/oauth2/__init__.py index 7ea103902..01e28ce39 100644 --- a/lifemonitor/auth/oauth2/__init__.py +++ b/lifemonitor/auth/oauth2/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/client/__init__.py b/lifemonitor/auth/oauth2/client/__init__.py index cb774e123..fbadff417 100644 --- a/lifemonitor/auth/oauth2/client/__init__.py +++ b/lifemonitor/auth/oauth2/client/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/client/controllers.py b/lifemonitor/auth/oauth2/client/controllers.py index 9638f62c1..ad0e37c29 100644 --- a/lifemonitor/auth/oauth2/client/controllers.py +++ b/lifemonitor/auth/oauth2/client/controllers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/client/models.py b/lifemonitor/auth/oauth2/client/models.py index a53d4f7f2..1d2f245a5 100644 --- a/lifemonitor/auth/oauth2/client/models.py +++ b/lifemonitor/auth/oauth2/client/models.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -33,6 +33,12 @@ from authlib.oauth2.rfc6749 import OAuth2Token as OAuth2TokenBase from flask import current_app from flask_login import current_user +from sqlalchemy import DateTime, inspect +from sqlalchemy.ext.hybrid import hybrid_property +from sqlalchemy.orm.attributes import flag_modified +from sqlalchemy.orm.collections import attribute_mapped_collection +from sqlalchemy.orm.exc import NoResultFound + from lifemonitor.auth import models from lifemonitor.cache import Timeout from lifemonitor.db import db @@ -41,11 +47,8 @@ NotAuthorizedException) from lifemonitor.models import JSON, ModelMixin from lifemonitor.utils import assert_service_is_alive, to_snake_case -from sqlalchemy import DateTime, inspect -from sqlalchemy.ext.hybrid import hybrid_property -from sqlalchemy.orm.attributes import flag_modified -from sqlalchemy.orm.collections import attribute_mapped_collection -from sqlalchemy.orm.exc import NoResultFound + +from .providers import new_instance as provider_config_helper_new_instance logger = logging.getLogger(__name__) @@ -257,6 +260,11 @@ def user_info(self): def user_info(self, value): self._user_info = value + @property + def profile_page(self) -> str: + logger.debug("Trying to get the user profile page for provider %r...", self.provider.name) + return self.provider.get_user_profile_page(self) + def __repr__(self): parts = [] parts.append(self.__class__.__name__) @@ -445,6 +453,19 @@ def get_user_info(self, provider_user_id, token, normalized=True): return data if not normalized \ else self.normalize_userinfo(OAuth2Registry.get_instance().get_client(self.name), data) + @property + def _provider_config_helper(self): + return provider_config_helper_new_instance(self.client_name) + + def get_user_profile_page(self, user_identity: OAuthIdentity) -> str: + try: + logger.warning("user info: %r", user_identity) + return self._provider_config_helper.get_user_profile_page(user_identity) + except AttributeError as e: + if logger.isEnabledFor(logging.DEBUG): + logger.exception("Unable to get the user profile page for provider: %r", e) + return None + @property def api_base_url(self): return self.api_resource.uri diff --git a/lifemonitor/auth/oauth2/client/providers/__init__.py b/lifemonitor/auth/oauth2/client/providers/__init__.py index 01dfd13bd..fb18d8b32 100644 --- a/lifemonitor/auth/oauth2/client/providers/__init__.py +++ b/lifemonitor/auth/oauth2/client/providers/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -53,11 +53,17 @@ def decorated_view(*args, **kwargs): return decorated_view +def __find_module_attribute__(m, attribute_name: str): + attribute_map = {k.lower(): k for k in dir(m) if not k.startswith('__')} + return attribute_map[attribute_name.lower()] + + def new_instance(provider_type, **kwargs): m = f"lifemonitor.auth.oauth2.client.providers.{provider_type.lower()}" try: mod = import_module(m) - return getattr(mod, provider_type.capitalize())(**kwargs) + provider_type_name = __find_module_attribute__(mod, provider_type) + return getattr(mod, provider_type_name)(**kwargs) except (ModuleNotFoundError, AttributeError) as e: logger.exception(e) raise OAuth2ProviderNotSupportedException(provider_type=provider_type, orig=e) diff --git a/lifemonitor/auth/oauth2/client/providers/github.py b/lifemonitor/auth/oauth2/client/providers/github.py index 450464e6f..07ae5e55c 100644 --- a/lifemonitor/auth/oauth2/client/providers/github.py +++ b/lifemonitor/auth/oauth2/client/providers/github.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -19,8 +19,11 @@ # SOFTWARE. import logging + from flask import current_app +from lifemonitor.auth.oauth2.client.models import OAuthIdentity + # Config a module level logger logger = logging.getLogger(__name__) @@ -66,11 +69,18 @@ class GitHub: 'client_kwargs': {'scope': 'read:user user:email'}, 'userinfo_endpoint': 'https://api.github.com/user', 'userinfo_compliance_fix': normalize_userinfo, + 'user_profile_html': 'https://github.com/settings/profile' } def __repr__(self) -> str: return f"Github Provider {self.name}" + @classmethod + def get_user_profile_page(cls, user_identity: OAuthIdentity): + logger.warning("user: %r", user_identity) + # the user profile page can be retrieved without user_provider_id + return cls.oauth_config['user_profile_html'] + @staticmethod def normalize_userinfo(client, data): return normalize_userinfo(client, data) diff --git a/lifemonitor/auth/oauth2/client/providers/lsaai.py b/lifemonitor/auth/oauth2/client/providers/lsaai.py index 8ca4a01d8..27681a237 100644 --- a/lifemonitor/auth/oauth2/client/providers/lsaai.py +++ b/lifemonitor/auth/oauth2/client/providers/lsaai.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -19,8 +19,11 @@ # SOFTWARE. import logging + from flask import current_app +from lifemonitor.auth.oauth2.client.models import OAuthIdentity + # Config a module level logger logger = logging.getLogger(__name__) @@ -69,12 +72,19 @@ class LsAAI: 'client_kwargs': {'scope': 'openid profile email orcid eduperson_principal_name'}, 'userinfo_endpoint': 'https://proxy.aai.lifescience-ri.eu/OIDC/userinfo', 'userinfo_compliance_fix': normalize_userinfo, + 'user_profile_html': 'https://profile.aai.lifescience-ri.eu/profile', 'server_metadata_url': 'https://proxy.aai.lifescience-ri.eu/.well-known/openid-configuration' } def __repr__(self) -> str: return "LSAAI Provider" + @classmethod + def get_user_profile_page(cls, user_identity: OAuthIdentity): + logger.warning("user: %r", user_identity) + # the user profile page can be retrieved without user_provider_id + return cls.oauth_config['user_profile_html'] + @staticmethod def normalize_userinfo(client, data): return normalize_userinfo(client, data) diff --git a/lifemonitor/auth/oauth2/client/providers/seek.py b/lifemonitor/auth/oauth2/client/providers/seek.py index 7aa2143df..ee8678f17 100644 --- a/lifemonitor/auth/oauth2/client/providers/seek.py +++ b/lifemonitor/auth/oauth2/client/providers/seek.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -19,10 +19,13 @@ # SOFTWARE. import logging -import requests from urllib.parse import urljoin + +import requests + from lifemonitor import exceptions -from ..models import OAuth2IdentityProvider + +from ..models import OAuth2IdentityProvider, OAuthIdentity # Config a module level logger logger = logging.getLogger(__name__) @@ -74,9 +77,14 @@ def normalize_userinfo(client, data): } return params + def __get_user_profile__(self, provider_user_id, json_format: bool = False) -> str: + format_opt = '?format=json' if json_format else '' + return urljoin(self.api_base_url, + f'/people/{provider_user_id}{format_opt}') + def get_user_info(self, provider_user_id, token, normalized=True): - response = requests.get(urljoin(self.api_base_url, - f'/people/{provider_user_id}?format=json'), + response = requests.get(self.__get_user_profile__(provider_user_id, + json_format=True), headers={'Authorization': f'Bearer {token["access_token"]}'}) if response.status_code != 200: try: @@ -91,6 +99,16 @@ def get_user_info(self, provider_user_id, token, normalized=True): logger.debug("USER info: %r", user_info) return user_info['data'] if not normalized else self.normalize_userinfo(None, user_info) + @classmethod + def get_user_profile_page(cls, user_identity: OAuthIdentity): + logger.debug("user: %r", user_identity) + # the user profile page can require user_provider_id + if not user_identity: + logger.warning("No identity found for user %r", user_identity) + return None + assert isinstance(user_identity.provider, cls), "Invalid provider" + return user_identity.provider.__get_user_profile__(user_identity.provider_user_id) + def refresh_oauth2_token(func): from . import refresh_oauth2_provider_token diff --git a/lifemonitor/auth/oauth2/client/services.py b/lifemonitor/auth/oauth2/client/services.py index e305ba274..7eaa66aeb 100644 --- a/lifemonitor/auth/oauth2/client/services.py +++ b/lifemonitor/auth/oauth2/client/services.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/client/utils.py b/lifemonitor/auth/oauth2/client/utils.py index d26a63f7e..e6faeed10 100644 --- a/lifemonitor/auth/oauth2/client/utils.py +++ b/lifemonitor/auth/oauth2/client/utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/server/__init__.py b/lifemonitor/auth/oauth2/server/__init__.py index 8237a1089..ce344a548 100644 --- a/lifemonitor/auth/oauth2/server/__init__.py +++ b/lifemonitor/auth/oauth2/server/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/server/controllers.py b/lifemonitor/auth/oauth2/server/controllers.py index 70ff9e830..f89d5122b 100644 --- a/lifemonitor/auth/oauth2/server/controllers.py +++ b/lifemonitor/auth/oauth2/server/controllers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/server/forms.py b/lifemonitor/auth/oauth2/server/forms.py index a17bb08cf..5abaa8467 100644 --- a/lifemonitor/auth/oauth2/server/forms.py +++ b/lifemonitor/auth/oauth2/server/forms.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/server/models.py b/lifemonitor/auth/oauth2/server/models.py index 9a4b82cf9..349c29eb4 100644 --- a/lifemonitor/auth/oauth2/server/models.py +++ b/lifemonitor/auth/oauth2/server/models.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/server/services.py b/lifemonitor/auth/oauth2/server/services.py index 49f3dc542..dd9aff633 100644 --- a/lifemonitor/auth/oauth2/server/services.py +++ b/lifemonitor/auth/oauth2/server/services.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/oauth2/server/utils.py b/lifemonitor/auth/oauth2/server/utils.py index a90a620fe..4c6a95cc3 100644 --- a/lifemonitor/auth/oauth2/server/utils.py +++ b/lifemonitor/auth/oauth2/server/utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/serializers.py b/lifemonitor/auth/serializers.py index 7e42c7fd4..fc7a06ac1 100644 --- a/lifemonitor/auth/serializers.py +++ b/lifemonitor/auth/serializers.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/services.py b/lifemonitor/auth/services.py index acb1f9b10..1a546a7dd 100644 --- a/lifemonitor/auth/services.py +++ b/lifemonitor/auth/services.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 CRS4 +# Copyright (c) 2020-2024 CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/lifemonitor/auth/templates/auth/account_tab.j2 b/lifemonitor/auth/templates/auth/account_tab.j2 index 2e4c637cf..2cd4daec9 100644 --- a/lifemonitor/auth/templates/auth/account_tab.j2 +++ b/lifemonitor/auth/templates/auth/account_tab.j2 @@ -8,47 +8,62 @@

Connected accounts

-
- - - - - - - - - - - {% for p in providers %} - - - - - {% if p.client_name in current_user.oauth_identity %} - - {% else %} - - {% endif %} - - {% endfor %} - +
+
ProviderUser ID
{{ macros.render_provider_fa_icon(p, color="black") }}{{p.name}}{% if p.client_name in current_user.oauth_identity %} - {{ current_user.oauth_identity[p.client_name].provider_user_id }} - {% endif %} - {% if current_user.oauth_identity|length > 1 or current_user.has_password %} - - CONNECTED - - - {% else %} - CONNECTED - {% endif %} - - - - CONNECT - - -
+ + + + + + + + + + {% for user_identity in user_identities %} + + + + + + + {% endfor %} +
ProviderUser ID
+ {{ macros.render_provider_fa_icon(user_identity.provider, color="black") }} + + {{user_identity.provider.name}} + + {% if user_identity.identity %} +
+ {{ user_identity.identity.provider_user_id }} +
+ + {% endif %} +
+ {% if user_identity.identity %} + {% if current_user.oauth_identity|length > 1 or current_user.has_password %} + + CONNECTED + + + {% else %} + CONNECTED + + {% endif %} + {% else %} + + CONNECT + + + {% endif %} +
diff --git a/lifemonitor/auth/templates/auth/profile.j2 b/lifemonitor/auth/templates/auth/profile.j2 index 34da6724a..41a646414 100644 --- a/lifemonitor/auth/templates/auth/profile.j2 +++ b/lifemonitor/auth/templates/auth/profile.j2 @@ -40,7 +40,7 @@
-