gn_module_export
Biodiversity data export module of GeoNature with fine-grained access control, with 5 PRs (3 merged) and 6 commits in May 2023. Contributions cover backend export logic, access control, SQLAlchemy query optimizations, and related frontend updates.
π― Context and goals
- Evolve production-grade naturalist applications across critical flows: import, synthesis, monitoring, taxonomy, and user management.
- Stabilize backend/frontend interfaces through stronger API contracts, filtering/pagination, dynamic forms, and more consistent error handling.
- Reduce manual business-side corrections by improving data model consistency, admin feedback, and UI flows.
π§© Design
- #project-gn-module-export: Merged PRs: #137 merged the Flask export view with consistent token-based permission handling; #162 filtered GeoNature application users in admin/backend flows; #164 exposed the API token all the way to the frontend export list.
π» Development
#project-gn-module-export: #137 merged authorized-role management directly into the Flask-Admin export view by adding
allowed_rolesto the admin form; #162 then restricted that selection to users and groups actually attached to the GeoNature application. Source: PR #162.def filter_user_app_and_role(): user_and_gp_from_gn_app = ( User.query.outerjoin(CorRole, User.id_role == CorRole.id_role_utilisateur) .outerjoin( UserApplicationRight, or_( UserApplicationRight.id_role == CorRole.id_role_groupe, UserApplicationRight.id_role == User.id_role, ), ) .join( Application, Application.id_application == UserApplicationRight.id_application, ) .filter(Application.code_application == "GN") ) return user_and_gp_from_gn_app.order_by( User.groupe.desc(), User.nom_role ).filter((User.groupe == True) | (User.identifiant.isnot(None)))- #project-gn-module-export: #164 wired the Angular UI to fetch exports, keep only the first authorized token per export, and drive token display / copy state inside the component. Source: PR #164.
this._exportService .getExports() .pipe( map((exports: Export[]) => { exports.forEach((element) => { element.cor_roles_exports.splice(1); }); return exports; }) ) .subscribe((exports: Export[]) => { exports.forEach((element) => { element.cor_roles_exports.length > 0 ? this.objectToken.push({ token: element.cor_roles_exports[0].token, display: false }) : this.objectToken.push({ token: null, display: false }); }); this.exports = exports; });
- #project-gn-module-export: #164 wired the Angular UI to fetch exports, keep only the first authorized token per export, and drive token display / copy state inside the component. Source: PR #164.
π Results
- PR count: 3
- Commit count: 6
- Issue count: 2
- Period: May 10, 2023 to May 16, 2023
Tech Stack
Frontend
Angular
Backend
Flask
Python
Bases de donnees (SGBD & SQL)
PostgreSQL
Design Patterns & Architecture
SQLAlchemy