g3w-admin-pdnd 2.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. g3w_admin_pdnd-2.0.2.dist-info/METADATA +85 -0
  2. g3w_admin_pdnd-2.0.2.dist-info/RECORD +99 -0
  3. g3w_admin_pdnd-2.0.2.dist-info/WHEEL +5 -0
  4. g3w_admin_pdnd-2.0.2.dist-info/licenses/LICENSE +21 -0
  5. g3w_admin_pdnd-2.0.2.dist-info/top_level.txt +1 -0
  6. qpdnd/__init__.py +0 -0
  7. qpdnd/admin.py +101 -0
  8. qpdnd/api/__init__.py +0 -0
  9. qpdnd/api/decorators/__init__.py +0 -0
  10. qpdnd/api/decorators/voucher_checker.py +229 -0
  11. qpdnd/api/models/__init__.py +2 -0
  12. qpdnd/api/models/aggiornamentoaccessi.py +121 -0
  13. qpdnd/api/models/aggiornamentointerni.py +63 -0
  14. qpdnd/api/models/aggiornamentoodonimi.py +133 -0
  15. qpdnd/api/models/consultazioni_comuni.py +37 -0
  16. qpdnd/api/models/coordinate.py +38 -0
  17. qpdnd/api/models/gestionecoordinate.py +44 -0
  18. qpdnd/api/models/mtype.py +21 -0
  19. qpdnd/api/permissions.py +51 -0
  20. qpdnd/api/views.py +575 -0
  21. qpdnd/apiurls.py +92 -0
  22. qpdnd/apps.py +39 -0
  23. qpdnd/fixtures/license.json +145 -0
  24. qpdnd/fixtures/qpdnd.istatcodiciui.json +1 -0
  25. qpdnd/forms/__init__.py +2 -0
  26. qpdnd/forms/anncsu.py +305 -0
  27. qpdnd/forms/projects.py +201 -0
  28. qpdnd/management/__init__.py +0 -0
  29. qpdnd/management/commands/__init__.py +0 -0
  30. qpdnd/management/commands/import_licenses_from_github.py +25 -0
  31. qpdnd/management/commands/run_task.py +27 -0
  32. qpdnd/migrations/0001_initial.py +35 -0
  33. qpdnd/migrations/0002_qpdndlayer_endpoint.py +18 -0
  34. qpdnd/migrations/0003_auto_20240725_1022.py +21 -0
  35. qpdnd/migrations/0004_qpdndproject_version.py +18 -0
  36. qpdnd/migrations/0005_auto_20240726_0929.py +23 -0
  37. qpdnd/migrations/0006_alter_qpdndproject_terms_of_service.py +18 -0
  38. qpdnd/migrations/0007_auto_20240730_0930.py +53 -0
  39. qpdnd/migrations/0008_license_node_id.py +18 -0
  40. qpdnd/migrations/0009_qpdndproject_license.py +19 -0
  41. qpdnd/migrations/0010_qpdndproject_x_api_id.py +18 -0
  42. qpdnd/migrations/0011_auto_20240920_0809.py +23 -0
  43. qpdnd/migrations/0012_alter_qpdndproject_qpdnd_env.py +18 -0
  44. qpdnd/migrations/0013_auto_20240920_0821.py +23 -0
  45. qpdnd/migrations/0014_qpdndproject_pdnd_eservice_is.py +18 -0
  46. qpdnd/migrations/0015_rename_pdnd_eservice_is_qpdndproject_pdnd_eservice_id.py +18 -0
  47. qpdnd/migrations/0016_alter_qpdndproject_terms_of_service.py +18 -0
  48. qpdnd/migrations/0017_auto_20250107_1102.py +38 -0
  49. qpdnd/migrations/0018_qpdndproject_client_setting.py +19 -0
  50. qpdnd/migrations/0019_auto_20250108_1636.py +46 -0
  51. qpdnd/migrations/0020_qpdndclientsetting_pdnd_audience.py +18 -0
  52. qpdnd/migrations/0021_alter_qpdndproject_project_anncsuroject.py +28 -0
  53. qpdnd/migrations/0022_rename_anncsuroject_anncsuproject.py +17 -0
  54. qpdnd/migrations/0023_anncsuproject_client_setting.py +19 -0
  55. qpdnd/migrations/0024_remove_anncsuproject_client_setting_and_more.py +27 -0
  56. qpdnd/migrations/0025_istatcodiciui.py +47 -0
  57. qpdnd/migrations/0026_anncsuproject_codice_comune.py +19 -0
  58. qpdnd/migrations/0027_anncsuproject_task_id.py +18 -0
  59. qpdnd/migrations/0028_alter_anncsuproject_project.py +19 -0
  60. qpdnd/migrations/0029_anncsuproject_govway_password_and_more.py +23 -0
  61. qpdnd/migrations/0030_anncsuproject_api_type.py +18 -0
  62. qpdnd/migrations/0031_anncsuproject_results.py +18 -0
  63. qpdnd/migrations/0032_alter_anncsuproject_api_type.py +18 -0
  64. qpdnd/migrations/0033_alter_anncsuproject_options.py +17 -0
  65. qpdnd/migrations/0034_anncsutaskhistory.py +35 -0
  66. qpdnd/migrations/__init__.py +0 -0
  67. qpdnd/models/__init__.py +2 -0
  68. qpdnd/models/anncsu.py +352 -0
  69. qpdnd/models/expose.py +165 -0
  70. qpdnd/receivers.py +93 -0
  71. qpdnd/run_celery.sh +11 -0
  72. qpdnd/server_filters/__init__.py +1 -0
  73. qpdnd/server_filters/layer.py +47 -0
  74. qpdnd/settings.py +161 -0
  75. qpdnd/sitetrees.py +58 -0
  76. qpdnd/static/qpdnd/js/widget.js +327 -0
  77. qpdnd/tasks.py +171 -0
  78. qpdnd/templates/qpdnd/anncsu/include/endpoint_check.html +29 -0
  79. qpdnd/templates/qpdnd/anncsu/include/task_status.html +11 -0
  80. qpdnd/templates/qpdnd/anncsu/project.html +78 -0
  81. qpdnd/templates/qpdnd/anncsu/project_list.html +95 -0
  82. qpdnd/templates/qpdnd/anncsu/run.html +186 -0
  83. qpdnd/templates/qpdnd/anncsu/run_conscom.html +72 -0
  84. qpdnd/templates/qpdnd/client_setting_form.html +37 -0
  85. qpdnd/templates/qpdnd/client_settings_list.html +59 -0
  86. qpdnd/templates/qpdnd/messages/check_project_delete.html +4 -0
  87. qpdnd/templates/qpdnd/messages/check_project_update.html +4 -0
  88. qpdnd/templates/qpdnd/project_form.html +45 -0
  89. qpdnd/templates/qpdnd/projects_list.html +95 -0
  90. qpdnd/urls.py +129 -0
  91. qpdnd/utils/__init__.py +0 -0
  92. qpdnd/utils/anncsu.py +490 -0
  93. qpdnd/utils/general.py +24 -0
  94. qpdnd/utils/pdnd.py +297 -0
  95. qpdnd/views/__init__.py +4 -0
  96. qpdnd/views/anncsu_admin.py +145 -0
  97. qpdnd/views/anncsu_run.py +160 -0
  98. qpdnd/views/client_settings.py +87 -0
  99. qpdnd/views/projects.py +87 -0
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: g3w-admin-pdnd
3
+ Version: 2.0.2
4
+ Summary: G3W-ADMIN plugin for Italy PDND service
5
+ Author-email: Gis3w snc <info@gis3w.it>
6
+ License: Mozilla Public License 2.0 (MPL 2.0)
7
+ Project-URL: Homepage, https://github.com/g3w-suite/g3w-admin-pdnd
8
+ Project-URL: Bug Tracker, https://github.com/g3w-suite/g3w-admin-pdnd/issues
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Environment :: Web Environment
11
+ Classifier: Framework :: Django
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Software Development :: Libraries
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: aiohttp==3.14.3
20
+ Requires-Dist: PyJWT<3.0.0,>=2.0.0
21
+ Requires-Dist: cryptography==38.0.4
22
+ Requires-Dist: pydantic==2.6.3
23
+ Provides-Extra: dev
24
+ Dynamic: license-file
25
+
26
+ # G3W-ADMIN-PDND
27
+
28
+ [![PyPI version](https://img.shields.io/pypi/v/g3w-admin-pdnd)](https://pypi.org/project/g3w-admin-pdnd/)
29
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/g3w-suite/g3w-admin-pdnd) [![CI](https://github.com/g3w-suite/g3w-admin-pdnd/actions/workflows/ci.yml/badge.svg)](https://github.com/g3w-suite/g3w-admin-pdnd/actions/workflows/ci.yml)
30
+
31
+ A [G3W-SUITE](https://github.com/g3w-suite) plugin for [**Piattaforma Digitale Nazionale Dati**](https://innovazione.gov.it/progetti/dati-e-interoperabilita/) (PDND).
32
+
33
+ ![PDND schema](doc/img/pdnd_schema.png)
34
+
35
+ ### Auhtentication
36
+ The plugin support the first level of authentication required by **PDND** based con `voucher token` analisys.
37
+
38
+ The second level of authentication base on `Agid-JWT-TrackingEvidence` http header is no supported.
39
+
40
+ *The Agid-JWT-TrackingEvidence header has been introduced in the AUDIT_REST_XX patterns with the update of the Technical Interoperability Guidelines of May 23, 2023*
41
+
42
+ ## Installation
43
+
44
+ Install *qpdnd* module into [`g3w-admin`](https://github.com/g3w-suite/g3w-admin/tree/v.3.6.x/g3w-admin) applications folder:
45
+
46
+ (Change the following 1.0.0 example version number)
47
+ ```sh
48
+ # Install module from github (v1.0.0)
49
+ pip3 install git+https://github.com/g3w-suite/g3w-admin-pdnd.git@v1.0.0
50
+
51
+ # Install module from github (dev branch)
52
+ # pip3 install git+https://github.com/g3w-suite/g3w-admin-pdnd.git@dev
53
+
54
+ # Install module from local folder (git development)
55
+ # pip3 install -e /g3w-admin/plugins/qpdnd
56
+
57
+ # Install module from PyPi (not yet available)
58
+ # pip3 install g3w-admin-pdnd
59
+ ```
60
+
61
+ ### Load lincense fixture data
62
+ ```sh
63
+ python3 manaage.py loaddata license
64
+ ```
65
+
66
+ ## Development and tests
67
+
68
+ The integration BDD scenarios are in [`qpdnd/tests/features`](qpdnd/tests/features).
69
+ They run in the G3W-ADMIN/QGIS environment used by CI. Install test dependencies:
70
+
71
+ ```sh
72
+ python3 -m pip install -r requirements_test.txt
73
+ ```
74
+
75
+ From the configured G3W-ADMIN directory, run:
76
+
77
+ ```sh
78
+ python3 manage.py behave --simple qpdnd/tests
79
+ ```
80
+
81
+ The existing Django unit tests can be run with:
82
+
83
+ ```sh
84
+ python3 manage.py test qpdnd
85
+ ```
@@ -0,0 +1,99 @@
1
+ g3w_admin_pdnd-2.0.2.dist-info/licenses/LICENSE,sha256=8v9byWbaxFunhr3QKTGoslqND7DZPP_HH9kJegD_BTw,1066
2
+ qpdnd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ qpdnd/admin.py,sha256=5ruQhYlsi82LccJkqrPEq5Q9Ck1K-jUQNI3Q1ntXYqU,2442
4
+ qpdnd/apiurls.py,sha256=mzgdj0hYGQNxxwsp3P3CQFgVIUaYzQB_zYYADep9G9Q,2661
5
+ qpdnd/apps.py,sha256=RX4Hd2lWZ8asi8ugKXpP2ts99jRp96kmD52MmqOttPI,1403
6
+ qpdnd/receivers.py,sha256=nz5YbMynh8k7ZNtrGIKOoY70bLE_2pQrKbNDFO3XC90,2903
7
+ qpdnd/run_celery.sh,sha256=p7DEdGLAxaBHOrW3JAYXD_WuFXMO_PhX5G8er6QrOIU,268
8
+ qpdnd/settings.py,sha256=1sIsH7XsIbd-2liFNK4d8FZ-Il60FldvUmmoSi1AyzI,4770
9
+ qpdnd/sitetrees.py,sha256=dmSNPwmQVQ9ESdeQcUuMdxzEU0upjzHfL9cM_kHg8Tw,3987
10
+ qpdnd/tasks.py,sha256=F_RyB87en3quBvLowOVL1PdlhuWdwLtaKBuptiDFQ4Y,5191
11
+ qpdnd/urls.py,sha256=BUoZQqQHU717Nz3jGV5Bq9pOM88O1szCPpuJOCTcqLA,3254
12
+ qpdnd/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ qpdnd/api/permissions.py,sha256=5B3RzfueVox2TwC_U0AkPr_Tt6pyZbm-Wi6o_wFFmNE,1380
14
+ qpdnd/api/views.py,sha256=fObbs0efm4EKzuq5e9H47_NskkPOFvDClBaZ4ueg-W0,19035
15
+ qpdnd/api/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ qpdnd/api/decorators/voucher_checker.py,sha256=GpOtiCHSmTUhARpYLetCIiZasWC3FiYOMw4kTiwlCmQ,8174
17
+ qpdnd/api/models/__init__.py,sha256=XqoZPL1ZYITi8rll39R_o5McsBF_nSX2L0Aty99cCto,69
18
+ qpdnd/api/models/aggiornamentoaccessi.py,sha256=pIFNSBbnXZBnI68kXTSCp6c8V7cIRknXB3GkeM2iW2I,4951
19
+ qpdnd/api/models/aggiornamentointerni.py,sha256=rQaoJ9E_NaO4N6nBcxCg61gG1regtDJYvQVkaBZ54B4,2791
20
+ qpdnd/api/models/aggiornamentoodonimi.py,sha256=mM0Slw1DpSZVPeHIhslj3EojuKByggvcth3su2DG2Gk,5166
21
+ qpdnd/api/models/consultazioni_comuni.py,sha256=w9WpIgfhMmcFZbAbCM03KoOfpV_-TJaYOSK3Y1cJaMs,1841
22
+ qpdnd/api/models/coordinate.py,sha256=n9SBMb6-EQvjNVQ-CE2FoW9V78FJXBIMf6ynJFeJVs0,1273
23
+ qpdnd/api/models/gestionecoordinate.py,sha256=_qcSlb0bpH6B1AUrke1vm6zO_1t7IGAdOw8XEWRpIh0,1178
24
+ qpdnd/api/models/mtype.py,sha256=uEYvL7Ehmseheu_Ww35KrtH5a5U_fSo2xsv20Yi0edM,455
25
+ qpdnd/fixtures/license.json,sha256=kHrqT4py-XlR0E4Ptmc_LclD4mNwCseguKgJqac37PE,3200
26
+ qpdnd/fixtures/qpdnd.istatcodiciui.json,sha256=WMpugfcLtkPu2YHhGACBiyofAkJK0m7Z-Bwtagou3ng,7850341
27
+ qpdnd/forms/__init__.py,sha256=nPMk_5Yetu9M93uE75uHm708q0UvBnE5M_mNlEZigFY,45
28
+ qpdnd/forms/anncsu.py,sha256=784N8T9IzhCQIZdM3_ESAOS-8f5AeGWzHJqJljTSX8o,10894
29
+ qpdnd/forms/projects.py,sha256=HM9IkLQQOM1vkBhZhtqyMwJ8gfeP0z_mXbqwEK6n_JU,7534
30
+ qpdnd/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ qpdnd/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
+ qpdnd/management/commands/import_licenses_from_github.py,sha256=8qKy78TAsa_hWptsUaz-qs9e1EhFYNiCWbAgXTb3Tow,681
33
+ qpdnd/management/commands/run_task.py,sha256=eReW2g7Gf4vFrIs53PPufdL5VCAghqDyG2oZL52eNGM,730
34
+ qpdnd/migrations/0001_initial.py,sha256=8lN-p26ZBs9Tr5QjX9mYs_GrjalQYf3GPnWvanytYas,1760
35
+ qpdnd/migrations/0002_qpdndlayer_endpoint.py,sha256=3xDLvbcrK6Iy-zFkM_Yv-HVhZ0MuxOixS0iXPW6CgEM,468
36
+ qpdnd/migrations/0003_auto_20240725_1022.py,sha256=hUCsqMGRs1h5bpV2XUcjzjDDcjylSM54LJjxTo53Obo,556
37
+ qpdnd/migrations/0004_qpdndproject_version.py,sha256=vBaETPX1ECGT6oxoa50voKxW5GEnBbhFFp3HX_ce19c,487
38
+ qpdnd/migrations/0005_auto_20240726_0929.py,sha256=v0-GHPK0XjvndRm3UmXsJOxh1ZgJv9M_EDHTruAcaNI,771
39
+ qpdnd/migrations/0006_alter_qpdndproject_terms_of_service.py,sha256=zuDlqMEJ8xAcsR7-0FcYJyAaPZaN6lEcaXD3UobWJZc,514
40
+ qpdnd/migrations/0007_auto_20240730_0930.py,sha256=5N7FX5mWbUKAl7bL2kVCHBc11znX2Zz1RB_8uXy8irM,2131
41
+ qpdnd/migrations/0008_license_node_id.py,sha256=Hz0MIM0MgAoy-SBCzAvCEIXlopgH-GQhFrWksBwzZiE,398
42
+ qpdnd/migrations/0009_qpdndproject_license.py,sha256=cIQLbwg7zYRlSMROm3UossvVzi2QYtbsznhYf1ohOlQ,495
43
+ qpdnd/migrations/0010_qpdndproject_x_api_id.py,sha256=pr07eqn3yNPSw_eX7eTzqekAm4yWeAw3TTxyd0-LLo4,416
44
+ qpdnd/migrations/0011_auto_20240920_0809.py,sha256=uS9J_0j7OVYQ6aIh7V39YKiAt0ftcAwTyfKI_xUTMrs,778
45
+ qpdnd/migrations/0012_alter_qpdndproject_qpdnd_env.py,sha256=qDIQIZajIJkeLjdOzMEATYsB6qZo3jZuQGX4Y_eW6z8,548
46
+ qpdnd/migrations/0013_auto_20240920_0821.py,sha256=mncZPsS9W8eBfXlBL9NTY9SZY-lWSg605ZppE3sRU1U,542
47
+ qpdnd/migrations/0014_qpdndproject_pdnd_eservice_is.py,sha256=G5cdFINOQlCJD5DCJUeBoGu0yC-UW_2wKiTnvlaATZ0,456
48
+ qpdnd/migrations/0015_rename_pdnd_eservice_is_qpdndproject_pdnd_eservice_id.py,sha256=dSwrA734LcyOW3O84eSPrS68vbTBXFWIOrj-ECkpZk8,399
49
+ qpdnd/migrations/0016_alter_qpdndproject_terms_of_service.py,sha256=OlOFCQpH058iV3Yx1gBrL-KoqVbL79_uBGnTzIZaDS8,609
50
+ qpdnd/migrations/0017_auto_20250107_1102.py,sha256=-tloXc2O1ChCdAExfpyu7Ke3_CY7YsMHpl2Q9nAqT7o,2245
51
+ qpdnd/migrations/0018_qpdndproject_client_setting.py,sha256=gPxmY1B78Ag1TR7QA0UtwgnYtpwwKhZuyLilhUKmfLc,503
52
+ qpdnd/migrations/0019_auto_20250108_1636.py,sha256=lHcLFUA1mK8IxTjDSKdznmI2kbgMu8H-dZqbmy8sHXY,1884
53
+ qpdnd/migrations/0020_qpdndclientsetting_pdnd_audience.py,sha256=ws_xzPq9AkBJxk6xG9t0_Un2scTydD9aJut8Wk7_68o,506
54
+ qpdnd/migrations/0021_alter_qpdndproject_project_anncsuroject.py,sha256=dBrex_bHwN8_bsrja0MHfoT91SylbDHQO0aBy54pMNk,1208
55
+ qpdnd/migrations/0022_rename_anncsuroject_anncsuproject.py,sha256=VFInwQGTg0FLlXphr31faIebAmEKl3c82jp06IdlLk8,363
56
+ qpdnd/migrations/0023_anncsuproject_client_setting.py,sha256=lIaAhQnMg4l9xcRe-N0k902Z3NV0FOFkvm__tIGZkU0,519
57
+ qpdnd/migrations/0024_remove_anncsuproject_client_setting_and_more.py,sha256=ANIEob_FUuhPRBawUe7xML3ynnd_SHXm49JViELs-Rk,794
58
+ qpdnd/migrations/0025_istatcodiciui.py,sha256=BHzmRF_dNO87bidJUH7x5CJbVHvzUX0POUjZkSc9s1c,3163
59
+ qpdnd/migrations/0026_anncsuproject_codice_comune.py,sha256=Xf_B2bJDyDJrxzWMRB0ELg9mFdF6CzYqIel7wFOlwLk,541
60
+ qpdnd/migrations/0027_anncsuproject_task_id.py,sha256=YWxmFwZmvuAfzuZGwIwGceoTchl_iuGzNdKrj-m_Dpo,459
61
+ qpdnd/migrations/0028_alter_anncsuproject_project.py,sha256=eAHpQvN28jHnSqtl-A1W5apOQMQBzDXPSIy7BZFYsrU,528
62
+ qpdnd/migrations/0029_anncsuproject_govway_password_and_more.py,sha256=0Jz1Hkbt7ORMARUXaRIfS5qhOLpg-lfKIb1TGEn9Dek,689
63
+ qpdnd/migrations/0030_anncsuproject_api_type.py,sha256=ZY5KCU347VgICru8heNvyNpQuvH5bOwFaLM--eeijc0,521
64
+ qpdnd/migrations/0031_anncsuproject_results.py,sha256=pFzWJqSGwcSqnSwJ_Fbx_tHHHioqpe0VfN-RElz0wwA,474
65
+ qpdnd/migrations/0032_alter_anncsuproject_api_type.py,sha256=xrhDhNhxCQ28uFFRfEh1bXbAJtdn24XTvCtnNtToX8Y,543
66
+ qpdnd/migrations/0033_alter_anncsuproject_options.py,sha256=9miLj95LnIKegdy5A3k82ffJvtsF6GXoQhPJtBlxAwk,408
67
+ qpdnd/migrations/0034_anncsutaskhistory.py,sha256=aTWOcm--GkLXX4XaLCjWK_qFSxbY7YHAo-8CDxQbNhc,1794
68
+ qpdnd/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
+ qpdnd/models/__init__.py,sha256=v9sQI0BM7SKoCmZCUNfC0iv4mBj5hdhrxx16b5NbaFc,43
70
+ qpdnd/models/anncsu.py,sha256=vz04AXj69LcZbvRpIjUh3N5JH-rHmTzGZ4pnm94qUrA,13168
71
+ qpdnd/models/expose.py,sha256=AQtBfSDAzb44xBRY6o6PaVmXpvwka6d6rJ8B0RRLqu8,7277
72
+ qpdnd/server_filters/__init__.py,sha256=FJO2vyATfPNN_fvmMlo3H9LJBLF3rDKVAHou5ZlZ-DA,20
73
+ qpdnd/server_filters/layer.py,sha256=0YF0QZ3RrbiTL6rGpYuxTSfZ106wR8pWlJG8jN2gLgc,1396
74
+ qpdnd/static/qpdnd/js/widget.js,sha256=k-_TZP66SBa3kNJWK1UGtIr9eVSiCUMsVVxvmwMm8RQ,11585
75
+ qpdnd/templates/qpdnd/client_setting_form.html,sha256=pTYo8bepUaLrwcc2kgmUw7ycGoqwD228B_knxbxB2ts,981
76
+ qpdnd/templates/qpdnd/client_settings_list.html,sha256=662V44FN-PS7E_KfCSFDa9IrxboPy9B44PDHYQ7np3k,2549
77
+ qpdnd/templates/qpdnd/project_form.html,sha256=xVnpnQKdKxHdhRmDowLxk_zDLlqvpDabWo8fREwmagg,1156
78
+ qpdnd/templates/qpdnd/projects_list.html,sha256=KG1Ngl4dYgle60X4qft8VPFf-sm3-4aTzJ3JBCBNbd4,5155
79
+ qpdnd/templates/qpdnd/anncsu/project.html,sha256=gu-WyQiArOI8j8YeyZa_m3NSUkvkG5V8E6HsVgGHOcA,2308
80
+ qpdnd/templates/qpdnd/anncsu/project_list.html,sha256=3X47hfcbipkuETQZaUFCIyoCqMBG55eyvXZCKQ6IFsI,3916
81
+ qpdnd/templates/qpdnd/anncsu/run.html,sha256=zxA40-7CIDaFmu7WN5mfGDUEC-Gu2SBRbmx768virMM,9399
82
+ qpdnd/templates/qpdnd/anncsu/run_conscom.html,sha256=ViQTLfi0Q5JjTMCud90LNA2B4rkF_hL7UBus3n6RdNY,2078
83
+ qpdnd/templates/qpdnd/anncsu/include/endpoint_check.html,sha256=vxJSJs7M1IMiL7J65NEw0EyJw8G7nIr76ivS2LmKTsU,1278
84
+ qpdnd/templates/qpdnd/anncsu/include/task_status.html,sha256=TVGfY-dNKletqhgkIem9Jg0MC3WIknucblakmZIuGIs,987
85
+ qpdnd/templates/qpdnd/messages/check_project_delete.html,sha256=Hu3cFEFCGjcpRAmHmTQsWx1LA6RpushNqu07-erU4oQ,250
86
+ qpdnd/templates/qpdnd/messages/check_project_update.html,sha256=fZxK4z_jdluZTdmYiJCzFt2wHvfDBXxolu12x8IX2Ps,277
87
+ qpdnd/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
+ qpdnd/utils/anncsu.py,sha256=QupfZOyDJvxQ8oPBBX_S9zV9pgP1wv6ycc6o_xt9NO0,18224
89
+ qpdnd/utils/general.py,sha256=GYYuHPjJKyJgsSEZIJM2vKi9WEwZtUiA8LHVQ1mNefk,592
90
+ qpdnd/utils/pdnd.py,sha256=7PJu5JWWdNEYHoHAyB1o0plGIwvCEEWOwtr0KkpPQc4,10282
91
+ qpdnd/views/__init__.py,sha256=3nng-DrhKMLXN-73rFmNWRqN8PpxLUh-3W3ZZX2FFS8,108
92
+ qpdnd/views/anncsu_admin.py,sha256=edEymca_3maTF_sUXo-NjynMJ98Jxh3dswJq34f3VWc,4430
93
+ qpdnd/views/anncsu_run.py,sha256=rhU9Oz9COZjAWtOA2I5H70_twimpyMJ_goU9zksA7Vk,5660
94
+ qpdnd/views/client_settings.py,sha256=TrzZ-qzVlkMtw7V-kvmkEtg1LEACUPgndNcuzu7pjDQ,2958
95
+ qpdnd/views/projects.py,sha256=1MPpMtGxs62ge2sZTCfOf48XwjSQKCaG00CNFyC-y78,2760
96
+ g3w_admin_pdnd-2.0.2.dist-info/METADATA,sha256=MKyoEwrsX0X4rrG0CAV5xg16N3LPLj2O2I9vPMnEnd0,3092
97
+ g3w_admin_pdnd-2.0.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
98
+ g3w_admin_pdnd-2.0.2.dist-info/top_level.txt,sha256=nF-hC_OPiVNwogQEXXoLtwPii9AXk2dHV8iMd5jYEXo,6
99
+ g3w_admin_pdnd-2.0.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 G3W-SUITE
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ qpdnd
qpdnd/__init__.py ADDED
File without changes
qpdnd/admin.py ADDED
@@ -0,0 +1,101 @@
1
+ from django.contrib import admin
2
+ from guardian.admin import GuardedModelAdmin
3
+ from qpdnd.models import (
4
+ QPDNDProject,
5
+ ANNCSUProject,
6
+ ANNCSUTaskHistory,
7
+ License,
8
+ IstatCodiciUi
9
+ )
10
+
11
+ @admin.register(QPDNDProject)
12
+ class QPDNDProjectAdmin(admin.ModelAdmin):
13
+ list_display = [
14
+ 'project',
15
+ 'endpoint'
16
+ ]
17
+
18
+
19
+ @admin.register(License)
20
+ class LicenseAdmin(admin.ModelAdmin):
21
+ pass
22
+
23
+ @admin.register(ANNCSUProject)
24
+ class ANNCSUProjectAdmin(GuardedModelAdmin):
25
+ list_display = [
26
+ 'project',
27
+ 'layer',
28
+ 'env_type',
29
+ ]
30
+
31
+
32
+ class ANNCSUTaskHistoryInline(admin.TabularInline):
33
+ model = ANNCSUTaskHistory
34
+ extra = 0
35
+ can_delete = False
36
+ fields = ['user', 'send_type', 'status', 'started_at', 'ended_at', 'task_id']
37
+ readonly_fields = ['user', 'send_type', 'status', 'started_at', 'ended_at', 'task_id']
38
+ show_change_link = True
39
+ ordering = ('-started_at',)
40
+
41
+ def has_add_permission(self, request, obj=None):
42
+ return False
43
+
44
+
45
+ ANNCSUProjectAdmin.inlines = [ANNCSUTaskHistoryInline]
46
+
47
+
48
+ @admin.register(IstatCodiciUi)
49
+ class IstatCodiciUiAdmin(admin.ModelAdmin):
50
+ pass
51
+
52
+
53
+ @admin.register(ANNCSUTaskHistory)
54
+ class ANNCSUTaskHistoryAdmin(admin.ModelAdmin):
55
+ list_display = [
56
+ 'id',
57
+ 'anncsu_project',
58
+ 'user',
59
+ 'send_type',
60
+ 'status',
61
+ 'started_at',
62
+ 'ended_at',
63
+ 'duration',
64
+ 'task_id',
65
+ ]
66
+ list_filter = ['status', 'send_type', 'anncsu_project']
67
+ search_fields = ['task_id', 'user__username', 'anncsu_project__project__title']
68
+ raw_id_fields = ['anncsu_project', 'user']
69
+ date_hierarchy = 'started_at'
70
+ ordering = ('-started_at',)
71
+ readonly_fields = [
72
+ 'anncsu_project',
73
+ 'user',
74
+ 'send_type',
75
+ 'status',
76
+ 'task_id',
77
+ 'started_at',
78
+ 'ended_at',
79
+ 'results',
80
+ 'duration',
81
+ ]
82
+ fieldsets = (
83
+ (None, {
84
+ 'fields': ('anncsu_project', 'user', 'send_type', 'task_id', 'status'),
85
+ }),
86
+ ('Timing', {
87
+ 'fields': ('started_at', 'ended_at', 'duration'),
88
+ }),
89
+ ('Result', {
90
+ 'fields': ('results',),
91
+ }),
92
+ )
93
+
94
+ def duration(self, obj):
95
+ if obj.started_at and obj.ended_at:
96
+ return obj.ended_at - obj.started_at
97
+ return '-'
98
+ duration.short_description = 'Duration'
99
+
100
+ def has_add_permission(self, request):
101
+ return False
qpdnd/api/__init__.py ADDED
File without changes
File without changes
@@ -0,0 +1,229 @@
1
+ # coding=utf-8
2
+ """"Checks for a valid JWS token in the request authorization header.
3
+
4
+ .. note:: This program is free software; you can redistribute it and/or modify
5
+ it under the terms of the Mozilla Public License 2.0.
6
+
7
+ """
8
+
9
+ __author__ = 'elpaso@itopen.it'
10
+ __date__ = '2024-09-16'
11
+ __copyright__ = 'Copyright 2024, Gis3w'
12
+
13
+ from xml.dom.domreg import well_known_implementations
14
+
15
+ from django.http import JsonResponse
16
+ from django.conf import settings
17
+ from django.core.cache import cache
18
+ from qpdnd.models import QPDNDProject
19
+ from qpdnd.utils.general import get_qpdnd_internal_user
20
+ import json
21
+ import jwt
22
+ import requests
23
+ import datetime
24
+ import uuid
25
+ import time
26
+
27
+ def _return_problem_json_response(title, status=401, details=None):
28
+ """
29
+ Build a JsonResponse follows RFC: https://datatracker.ietf.org/doc/html/rfc7807#section-3.1
30
+ """
31
+
32
+ data = {
33
+ 'status': status,
34
+ 'title': title
35
+ }
36
+
37
+ if details:
38
+ data.update({
39
+ 'details': details
40
+ })
41
+
42
+ return JsonResponse(data,
43
+ status=status,
44
+ **{'content_type': 'application/problem+json'})
45
+
46
+
47
+ def _get_server_client_assertion(audience, client_id, issuer, subject, private_key):
48
+ """
49
+ Create a client assertion (where G3WSuite is the client) to get PDND a voucher
50
+ """
51
+
52
+ issued = datetime.datetime.utcnow()
53
+ delta = datetime.timedelta(minutes=120)
54
+ expire_in = issued + delta
55
+ jti = uuid.uuid4()
56
+
57
+ headers_rsa = {
58
+ "kid": client_id,
59
+ "alg": "RS256",
60
+ "typ": "JWT"
61
+ }
62
+
63
+ payload = {
64
+ "iss": issuer,
65
+ "sub": subject,
66
+ "aud": audience,
67
+ #"purposeId": PURPOSEID, # Not needed for server assertion
68
+ "jti": str(jti),
69
+ "iat": issued,
70
+ "exp": expire_in
71
+ }
72
+
73
+ return jwt.encode(payload, private_key, algorithm="RS256", headers=headers_rsa)
74
+
75
+
76
+ def _get_voucher(url, client_id, client_assertion):
77
+ """
78
+ Make a POST request to PDND
79
+ """
80
+
81
+ # Note: client_id is the ISSUER, not KID!!!
82
+ data = {
83
+ 'client_id': client_id,
84
+ 'client_assertion': client_assertion,
85
+ 'client_assertion_type': 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
86
+ 'grant_type': 'client_credentials'
87
+ }
88
+
89
+ return requests.post(url, data=data, headers={'Content-Type': 'application/x-www-form-urlencoded'})
90
+
91
+
92
+ def pdnd_voucher_required(func):
93
+ """
94
+ Decorator for views that checks that the user has a valid JWS token.
95
+ """
96
+
97
+ def _wrapped_view(request, *args, **kwargs):
98
+
99
+ # If user is superuser, skip the check
100
+ if request.user.is_superuser:
101
+ return func(request, *args, **kwargs)
102
+
103
+ if settings.QPDND_VOUCHER_VALIDATE:
104
+
105
+ # Get parameters for OWS:ows-wfs3 url by endpoint url parameter
106
+ qpdndp = QPDNDProject.objects.get(endpoint=kwargs['endpoint'])
107
+ qpdndcs = qpdndp.client_setting
108
+
109
+ # Caching well-known endpoint response
110
+ # Caching by key for qpdndclientsetting model instance pk
111
+ wn_cache_key = f'qpdnd_well_known_{qpdndcs.pk}'
112
+
113
+ # Extract the JWS token from the request authorization:bearer header
114
+ token = request.META.get('HTTP_AUTHORIZATION', '').split(' ')[-1]
115
+
116
+ if not token:
117
+ return _return_problem_json_response('Invalid token (empty)')
118
+
119
+ try:
120
+ header = jwt.get_unverified_header(token)
121
+ except Exception as e:
122
+ return _return_problem_json_response(str(e))
123
+
124
+ if not header.get('typ', '') == 'at+jwt':
125
+ return _return_problem_json_response('Invalid token (wrong type)')
126
+
127
+ alg = header.get('alg', '')
128
+ # NOTE: only RS256 is supported?
129
+ if not alg == 'RS256':
130
+ return _return_problem_json_response('Invalid token (unsupported algorithm)')
131
+
132
+ if not header.get('use', '') == 'sig':
133
+ return _return_problem_json_response('Invalid token (invalid use)')
134
+
135
+ kid = header.get('kid', '')
136
+ if not kid:
137
+ return _return_problem_json_response('Invalid token (empty kid)')
138
+
139
+ # Get the public key from the well-known endpoint
140
+ # Try to get cached response
141
+ well_known_response = cache.get(wn_cache_key)
142
+
143
+ if not well_known_response:
144
+ print('chiamate well none')
145
+ well_known_response = requests.get(qpdndcs.pdnd_well_known_url)
146
+ else:
147
+ print('chiamate well cache')
148
+
149
+ # Search for kid in the json response
150
+ public_key = None
151
+ for key in well_known_response.json().get('keys', []):
152
+ if key.get('kid', '') == kid:
153
+ public_key = jwt.algorithms.RSAAlgorithm.from_jwk(json.dumps(key))
154
+ break
155
+
156
+ if not public_key:
157
+ return _return_problem_json_response('Invalid token (kid not found in .well-known)')
158
+
159
+ # Decode and validate the JWS token
160
+ try:
161
+ options = {
162
+ "verify_iat": False
163
+ }
164
+
165
+ # For testing
166
+ if settings.QPDND_TESTING_RUNNING:
167
+ options.update({
168
+ "verify_exp": False
169
+ })
170
+
171
+ payload = jwt.decode(token, public_key,
172
+ algorithms=[alg],
173
+ audience=qpdndp.pdnd_audience,
174
+ issuer=qpdndcs.pdnd_issuer,
175
+ options=options
176
+ )
177
+ except Exception as e:
178
+ return _return_problem_json_response(str(e))
179
+
180
+ # For testing
181
+ if settings.QPDND_TESTING_RUNNING:
182
+ payload['exp'] = settings.QPDND_TESTING_VOUCHER_EXP
183
+
184
+ # Caching well-known endpoint response
185
+ cache.set(wn_cache_key, well_known_response, int(payload['exp'] - time.time()))
186
+
187
+ # Verify that the purposeId in the token is authorized by calling PDND API
188
+ purpose_id = None
189
+ try:
190
+ purpose_id = payload.get('purposeId')
191
+ except Exception as e:
192
+ return _return_problem_json_response('Invalid token (missing purposeId)')
193
+
194
+ # Get the voucher from the PDND API
195
+ server_assertion = _get_server_client_assertion(
196
+ qpdndcs.pdnd_audience,
197
+ qpdndcs.pdnd_server_kid,
198
+ qpdndcs.pdnd_server_issuer,
199
+ qpdndcs.pdnd_server_subject,
200
+ qpdndcs.pdnd_private_key
201
+ )
202
+
203
+ server_result = _get_voucher(qpdndcs.pdnd_api_token_url, qpdndcs.pdnd_server_issuer, server_assertion)
204
+
205
+ if server_result.status_code != 200:
206
+ return _return_problem_json_response('PDND voucher request failed')
207
+
208
+ server_access_token = server_result.json()['access_token']
209
+ purpose_verification_url = qpdndcs.pdnd_api_purpose_verification_url.format(purposeId=purpose_id)
210
+ purpose_verification_response = requests.get(purpose_verification_url, headers={settings.QPDND_AUTH_HEADER: 'Bearer ' + server_access_token})
211
+
212
+ if purpose_verification_response.status_code != 200:
213
+ return _return_problem_json_response('PDND purpose request verification failed')
214
+
215
+ purpose_verification_response_json = purpose_verification_response.json()
216
+ state = purpose_verification_response_json.get('state', False)
217
+ if state != 'ACTIVE':
218
+ return _return_problem_json_response('PDND purpose state verification failed')
219
+
220
+ eserviceId = purpose_verification_response_json.get('eserviceId', False)
221
+ if not eserviceId or not eserviceId == qpdndp.pdnd_eservice_id:
222
+ return _return_problem_json_response('PDND purpose eserviceId verification failed')
223
+
224
+ # All checks passed, call the view
225
+ # set internal qdpnd user
226
+ request.user = get_qpdnd_internal_user()
227
+ return func(request, *args, **kwargs)
228
+
229
+ return _wrapped_view
@@ -0,0 +1,2 @@
1
+ from .gestionecoordinate import *
2
+ from .aggiornamentoaccessi import *