Code source de geonature.core.users.models

from sqlalchemy import ForeignKey
from pypnusershub.db.models import User
from utils_flask_sqla.serializers import serializable
from sqlalchemy.sql import select, func
from sqlalchemy.dialects.postgresql import UUID

from geonature.utils.env import DB


@serializable
[docs] class VUserslistForallMenu(DB.Model):
[docs] __tablename__ = "v_userslist_forall_menu"
[docs] __table_args__ = {"schema": "utilisateurs"}
[docs] id_role = DB.Column(DB.Integer, primary_key=True)
[docs] nom_role = DB.Column(DB.Unicode)
[docs] prenom_role = DB.Column(DB.Unicode)
[docs] nom_complet = DB.Column(DB.Unicode)
[docs] id_menu = DB.Column(DB.Integer, primary_key=True)
@serializable
[docs] class CorRole(DB.Model):
[docs] __tablename__ = "cor_roles"
[docs] __table_args__ = {"schema": "utilisateurs", "extend_existing": True}
[docs] id_role_groupe = DB.Column( DB.Integer, ForeignKey("utilisateurs.t_roles.id_role"), primary_key=True )
[docs] id_role_utilisateur = DB.Column(DB.Integer, primary_key=True)
[docs] role = DB.relationship( User, primaryjoin=(User.id_role == id_role_groupe), foreign_keys=[id_role_groupe], )
def __init__(self, id_group, id_role): self.id_role_groupe = id_group self.id_role_utilisateur = id_role
@serializable
[docs] class TApplications(DB.Model):
[docs] __tablename__ = "t_applications"
[docs] __table_args__ = {"schema": "utilisateurs", "extend_existing": True}
[docs] id_application = DB.Column(DB.Integer, primary_key=True)
[docs] nom_application = DB.Column(DB.Unicode)
[docs] desc_application = DB.Column(DB.Unicode)
[docs] id_parent = DB.Column(DB.Integer)
[docs] class UserRigth: def __init__( self, id_role=None, id_organisme=None, code_action=None, value_filter=None, module_code=None, nom_role=None, prenom_role=None, ): self.id_role = id_role self.id_organisme = id_organisme self.value_filter = value_filter self.code_action = code_action self.module_code = module_code self.nom_role = nom_role self.prenom_role = prenom_role