diff --git a/atlas/atlasRoutes.py b/atlas/atlasRoutes.py index 21b95163..1335d50e 100644 --- a/atlas/atlasRoutes.py +++ b/atlas/atlasRoutes.py @@ -207,12 +207,18 @@ def index(): connection.close() session.close() + personal_data = False + args_personal_data = request.args.get("personal_data") + if args_personal_data and args_personal_data.lower() == "true": + personal_data = True + return render_template( "templates/home/_main.html", observations=observations, mostViewTaxon=mostViewTaxon, customStatMedias=customStatMedias, lastDiscoveries=lastDiscoveries, + personal_data=personal_data, ) diff --git a/atlas/static/custom/templates/footer.html.sample b/atlas/static/custom/templates/footer.html.sample index 4ce97603..512c7495 100644 --- a/atlas/static/custom/templates/footer.html.sample +++ b/atlas/static/custom/templates/footer.html.sample @@ -74,22 +74,30 @@ {% endif %} -{% if configuration.ID_GOOGLE_ANALYTICS != "UA-xxxxxxx-xx" %} - - + ga('create', '{{configuration.ID_GOOGLE_ANALYTICS}}', 'auto'); + ga('send', 'pageview'); + + {% endif %} + {% endfor %} {% endif %} diff --git a/atlas/static/main.js b/atlas/static/main.js index 92fb2f89..b4d26360 100644 --- a/atlas/static/main.js +++ b/atlas/static/main.js @@ -139,3 +139,21 @@ if (configuration.GLOSSAIRE) { }); }); } + + +var orejimeConfig = { + elementID: "orejime", + appElement: "main", + cookieName: "orejime", + cookieExpiresAfterDays: 365, + privacyPolicy: "/?personal_data=true", + default: true, + mustConsent: false, + mustNotice: false, + lang: configuration.DEFAULT_LANGUAGE, + logo: false, + debug: configuration.modeDebug, + translations: configuration.OREJIME_TRANSLATIONS, + apps: configuration.OREJIME_APPS, + categories: configuration.OREJIME_CATEGORIES +} diff --git a/atlas/static/package-lock.json b/atlas/static/package-lock.json index f8dfea67..e41de16a 100644 --- a/atlas/static/package-lock.json +++ b/atlas/static/package-lock.json @@ -398,6 +398,14 @@ "@babel/helper-plugin-utils": "^7.14.5" } }, + "@babel/runtime": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz", + "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", + "requires": { + "regenerator-runtime": "^0.14.0" + } + }, "@babel/template": { "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.14.5.tgz", @@ -1443,6 +1451,11 @@ "strip-final-newline": "^2.0.0" } }, + "exenv": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", + "integrity": "sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==" + }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -2330,8 +2343,7 @@ "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "js-yaml": { "version": "3.14.1", @@ -2462,6 +2474,14 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -2586,6 +2606,11 @@ "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", "dev": true }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2618,6 +2643,15 @@ "word-wrap": "~1.2.3" } }, + "orejime": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/orejime/-/orejime-2.3.0.tgz", + "integrity": "sha512-eDUgd5yEF5pCIUHPNXVDKmgH+4k4GEwxU7eexBFeVESba3ZYDHSDq4ULXiF2LnZwxg+H6Qi28o8rGfGxNeOriA==", + "requires": { + "@babel/runtime": "^7.1.2", + "react-modal": "^3.13.1" + } + }, "p-each-series": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.2.0.tgz", @@ -2743,6 +2777,23 @@ "sisteransi": "^1.0.5" } }, + "prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + }, + "dependencies": { + "react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + } + } + }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -2769,6 +2820,27 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, + "react-lifecycles-compat": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" + }, + "react-modal": { + "version": "3.16.1", + "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.16.1.tgz", + "integrity": "sha512-VStHgI3BVcGo7OXczvnJN7yT2TWHJPDXZWyI/a0ssFNhGZWsPmB8cF0z33ewDXq4VfYMO1vXgiv/g8Nj9NDyWg==", + "requires": { + "exenv": "^1.2.0", + "prop-types": "^15.7.2", + "react-lifecycles-compat": "^3.0.0", + "warning": "^4.0.3" + } + }, + "regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -3135,6 +3207,14 @@ "makeerror": "1.0.x" } }, + "warning": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", + "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", + "requires": { + "loose-envify": "^1.0.0" + } + }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", diff --git a/atlas/static/package.json b/atlas/static/package.json index 9a365048..a2b43581 100644 --- a/atlas/static/package.json +++ b/atlas/static/package.json @@ -33,6 +33,7 @@ "leaflet.snogylop": "^0.4.0", "leaflet.zoomhome": "^1.0.0", "lightbox2": "^2.8.2", + "orejime": "^2.3.0", "popper.js": "^1.16.0", "raphael": "^2.2.0", "slick": "^1.12.2", diff --git a/atlas/templates/core/assets_header.html b/atlas/templates/core/assets_header.html index 83d4efc8..4ec8ba92 100644 --- a/atlas/templates/core/assets_header.html +++ b/atlas/templates/core/assets_header.html @@ -38,4 +38,8 @@ + + + + {% endblock %} diff --git a/atlas/templates/home/_main.html b/atlas/templates/home/_main.html index 3c8c4b5b..f329ac3a 100644 --- a/atlas/templates/home/_main.html +++ b/atlas/templates/home/_main.html @@ -28,6 +28,12 @@ + {% if personal_data %} + + {% endif %} + {% endblock %} diff --git a/docs/images/choice_rgpd.png b/docs/images/choice_rgpd.png new file mode 100644 index 00000000..ac222405 Binary files /dev/null and b/docs/images/choice_rgpd.png differ diff --git a/docs/rgpd.rst b/docs/rgpd.rst new file mode 100644 index 00000000..3588dc48 --- /dev/null +++ b/docs/rgpd.rst @@ -0,0 +1,139 @@ +La RGPD +======= + +À quoi sert la RGPD +------------------- + +Le règlement général sur la protection des données est utilisé afin de protéger les données à caractère personnel. + +Où configurer l'application +--------------------------- + +Dans le fichier : `atlas/configuration/config.py` + +La documentation correspondant à la configuration : https://github.com/empreinte-digitale/orejime + +- Définir les applications pour lesquelles il faut bloquer les cookies via la variable **OREJIME_APPS** + +:: + + OREJIME_APPS = [ + { + "name": "scripts-gtm", + "title": "Google Analytics", + "cookies": [ + "_ga", + "_gat", + "_gid", + "__utma", + "__utmb", + "__utmc", + "__utmt", + "__utmz", + ], + "purposes": ["analytics"], + "required": False, + "optOut": False, + "default": True, + "onlyOnce": True, + }, + { + "name": "second-script", + "title": "Deuxième script", + "cookies": [ + "_ga", + "_gat", + "_gid", + "__utma", + "__utmb", + "__utmc", + "__utmt", + "__utmz", + ], + "purposes": ["analytics"], + "required": False, + "optOut": False, + "default": True, + "onlyOnce": True, + } + ] + +- Il est possible de surcharger les traductions grâce à la variable : **OREJIME_TRANSLATIONS** + +:: + + OREJIME_TRANSLATIONS = { + "en": { + "consentModal": { + "description": "This is an example of how to override an existing translation already used by Orejime", + }, + "inlineTracker": { + "description": "Example of an inline tracking script", + }, + "externalTracker": { + "description": "Example of an external tracking script", + }, + "purposes": { + "analytics": "Analytics", + "security": "Security" + }, + "categories": { + "analytics": { + "description": "A long form description of the category." + } + } + }, + } + +- Il est possible de catégoriser les applications nécessaires afin de les intégrer dans les choix des utilisateurs. + +.. image :: images/choice_rgpd.png + + +:: + + OREJIME_CATEGORIES = [ + { + "name": "analytics", + "title": "Analytics", + "apps": [ + "scripts-gtm", + "second-script" + ] + } + ] + +Dans le fichier : `atlas/static/custom/templates/footer.html` + +- Dans le fichier, rajouter un **if** pour chacun des scripts à exécuter. + +Dans cet exemple, il s'agit d'un script de google analitics (le script `scripts-gtm` définit dans la configuration orejime dans le fichier `config.py`). + +:: + + {% if configuration.OREJIME_APPS|length > 0 %} + + {% for app in configuration.OREJIME_APPS %} + {% if app.name == "scripts-gtm" %} + + {% endif %} + {% endfor %} + {% endif %}