Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLechemia committed May 29, 2019
2 parents bf1244b + 70c2289 commit 875894a
Show file tree
Hide file tree
Showing 186 changed files with 12,397 additions and 2,396 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ external_assets/
external_modules/*
tmp/
var/
data/migrations/v1tov2/v1_compat.ini
data/migrations/v1tov2/v1_compat.log
data/migrations/v1tov2/old/v1_compat.ini
data/migrations/v1tov2/old/v1_compat.log
data/migrations/v1tov2/migratetoV2.ini

config.py
backend/static/medias/*
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ notifications:
email:
recipients:
- geonature@ecrins-parcnational.fr
on_failure: always
on_failure: never
on_success: never
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Présentation de GeoNature sur http://geonature.fr et dans http://geonature.fr/d
Modules et projets liés
=======================

* UsersHub (gestion des utilisateurs et de leurs droits) : https://github.com/PnEcrins/UsersHub
* UsersHub (gestion des utilisateurs et de leurs droits) : https://github.com/PnX-SI/UsersHub
* Sous-module d'authentification UsersHub : https://github.com/PnX-SI/UsersHub-authentification-module
* TaxHub (gestion des taxons) : https://github.com/PnX-SI/TaxHub
* Nomenclature API (gestion des nomenclatures) : https://github.com/PnX-SI/Nomenclature-api-module
Expand All @@ -53,7 +53,7 @@ Modules et projets liés
Gestion des utilisateurs
========================

La gestion des utilisateurs est déportée dans l'application UsersHub (https://github.com/PnEcrins/UsersHub).
La gestion des utilisateurs est déportée dans l'application UsersHub (https://github.com/PnX-SI/UsersHub).
Celle-ci permet de centraliser les utilisateurs et observateurs, de les ajouter dans un groupe et d'hériter directement de droits dans l'ensemble des applications (GeoNature, Faune, Flore, Geotrek, Police...).

A chaque ajout ou modification dans l'application UsersHub sa base de données est mise à jour ainsi que tous les schémas ``utilisateurs`` des applications qui sont connectées à UsersHub.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.1
2.0.2.dev0
7 changes: 5 additions & 2 deletions backend/geonature/core/command/create_gn_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
@click.argument("url") # url de l'api
@click.option("--conf-file", required=False, default=DEFAULT_CONFIG_FILE)
@click.option("--build", type=bool, required=False, default=True)
def install_gn_module(module_path, url, conf_file, build):
@click.option("--enable_backend", type=bool, required=False, default=True)
def install_gn_module(module_path, url, conf_file, build, enable_backend):
"""
Installation d'un module gn
"""
Expand Down Expand Up @@ -97,7 +98,9 @@ def install_gn_module(module_path, url, conf_file, build):
module_path, module_code.lower()
)
# ajout du module dans la table gn_commons.t_modules
add_application_db(app, module_code, url, enable_frontend)
add_application_db(
app, module_code, url, enable_frontend, enable_backend
)

# Enregistrement de la config du module
gn_module_register_config(module_code.lower())
Expand Down
104 changes: 94 additions & 10 deletions backend/geonature/core/gn_commons/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from sqlalchemy import ForeignKey
from sqlalchemy.sql import select, func
from sqlalchemy.dialects.postgresql import UUID
from geoalchemy2 import Geometry

from pypnnomenclature.models import TNomenclatures
from pypnusershub.db.models import User

from geonature.utils.utilssqlalchemy import serializable
from geonature.utils.utilssqlalchemy import serializable, geoserializable
from geonature.utils.env import DB


Expand Down Expand Up @@ -92,24 +93,91 @@ class TParameters(DB.Model):


@serializable
class VLastestValidation(DB.Model):
__tablename__ = "v_lastest_validation"
@geoserializable
class VLatestValidations(DB.Model):
__tablename__ = "v_latest_validations_for_web_app"
__table_args__ = {"schema": "gn_commons"}

id_validation = DB.Column(DB.Integer, primary_key=True)
id_synthese = DB.Column(
DB.Integer,
ForeignKey("gn_synthese.v_synthese_decode_nomenclatures.id_synthese"),
primary_key=True,
)
unique_id_sinp = DB.Column(UUID(as_uuid=True))
unique_id_sinp_grp = DB.Column(UUID(as_uuid=True))
id_source = DB.Column(DB.Integer)
entity_source_pk_value = DB.Column(DB.Integer)
id_dataset = DB.Column(DB.Integer)
dataset_name = DB.Column(DB.Integer)
id_acquisition_framework = DB.Column(DB.Integer)
count_min = DB.Column(DB.Integer)
count_max = DB.Column(DB.Integer)
cd_nom = DB.Column(DB.Integer)
cd_ref = DB.Column(DB.Unicode)
nom_cite = DB.Column(DB.Unicode)
nom_valide = DB.Column(DB.Unicode)
nom_vern = DB.Column(DB.Unicode)
lb_nom = DB.Column(DB.Unicode)
meta_v_taxref = DB.Column(DB.Unicode)
sample_number_proof = DB.Column(DB.Unicode)
digital_proof = DB.Column(DB.Unicode)
non_digital_proof = DB.Column(DB.Unicode)
altitude_min = DB.Column(DB.Unicode)
altitude_max = DB.Column(DB.Unicode)
the_geom_4326 = DB.Column(Geometry("GEOMETRY", 4326))
date_min = DB.Column(DB.DateTime)
date_max = DB.Column(DB.DateTime)
validator = DB.Column(DB.Unicode)
observers = DB.Column(DB.Unicode)
determiner = DB.Column(DB.Unicode)
id_digitiser = DB.Column(DB.Integer)
comment_context = DB.Column(DB.Unicode)
comment_description = DB.Column(DB.Unicode)
meta_validation_date = DB.Column(DB.DateTime)
meta_create_date = DB.Column(DB.DateTime)
meta_update_date = DB.Column(DB.DateTime)
last_action = DB.Column(DB.Unicode)
id_nomenclature_geo_object_nature = DB.Column(DB.Integer)
id_nomenclature_info_geo_type = DB.Column(DB.Integer)
id_nomenclature_grp_typ = DB.Column(DB.Integer)
id_nomenclature_obs_meth = DB.Column(DB.Integer)
id_nomenclature_obs_technique = DB.Column(DB.Integer)
id_nomenclature_bio_status = DB.Column(DB.Integer)
id_nomenclature_bio_condition = DB.Column(DB.Integer)
id_nomenclature_naturalness = DB.Column(DB.Integer)
id_nomenclature_exist_proof = DB.Column(DB.Integer)
id_nomenclature_diffusion_level = DB.Column(DB.Integer)
id_nomenclature_life_stage = DB.Column(DB.Integer)
id_nomenclature_sex = DB.Column(DB.Integer)
id_nomenclature_obj_count = DB.Column(DB.Integer)
id_nomenclature_type_count = DB.Column(DB.Integer)
id_nomenclature_sensitivity = DB.Column(DB.Integer)
id_nomenclature_observation_status = DB.Column(DB.Integer)
id_nomenclature_blurring = DB.Column(DB.Integer)
id_nomenclature_source_status = DB.Column(DB.Integer)
id_nomenclature_source_status = DB.Column(DB.Integer)
name_source = DB.Column(DB.Unicode)
url_source = DB.Column(DB.Unicode)
id_validation = DB.Column(DB.Integer)
id_table_location = DB.Column(DB.Integer)
uuid_attached_row = DB.Column(UUID(as_uuid=True))
id_nomenclature_valid_status = DB.Column(DB.Integer)
id_validator = DB.Column(DB.Integer)
validation_comment = DB.Column(DB.Unicode)
validation_date = DB.Column(DB.DateTime)
validation_auto = DB.Column(DB.Boolean)
label_default = DB.Column(DB.Unicode)
mnemonique = DB.Column(DB.Unicode)

def get_geofeature(self, recursif=False, columns=()):
return self.as_geofeature(
"the_geom_4326", "id_synthese", recursif, columns=columns
)


@serializable
class TValidations(DB.Model):
__tablename__ = "t_validations"
__table_args__ = {"schema": "gn_commons", "extend_existing":True}
__table_args__ = {"schema": "gn_commons"}

id_validation = DB.Column(DB.Integer, primary_key=True)
id_table_location = DB.Column(DB.Integer)
Expand All @@ -123,14 +191,30 @@ class TValidations(DB.Model):
validation_label = DB.relationship(
TNomenclatures,
primaryjoin=(TNomenclatures.id_nomenclature == id_nomenclature_valid_status),
foreign_keys=[id_nomenclature_valid_status]
foreign_keys=[id_nomenclature_valid_status],
)
validator_role = DB.relationship(
User,
primaryjoin=(User.id_role == id_validator),
foreign_keys=[id_validator]
User, primaryjoin=(User.id_role == id_validator), foreign_keys=[id_validator]
)

def __init__(
self,
id_validation,
id_table_location,
uuid_attached_row,
id_nomenclature_valid_status,
id_validator,
validation_comment,
validation_date,
validation_auto,
):
self.id_table_location = id_table_location
self.uuid_attached_row = uuid_attached_row
self.id_nomenclature_valid_status = id_nomenclature_valid_status
self.id_validator = id_validator
self.validation_comment = validation_comment
self.validation_date = validation_date
self.validation_auto = validation_auto


@serializable
Expand Down
Loading

0 comments on commit 875894a

Please sign in to comment.