from sqlalchemy import Sequence, Column, Integer, String,ForeignKey,Boolean import persistence __db_Base = persistence.get_db_base() class isp(__db_Base) : __tablename__ = 'tIsp' id = Column(Integer, Sequence('isp_id_seq'), primary_key=True,nullable=False) name = Column(String(50)) description = Column(String(500)) class user_account(__db_Base) : __tablename__ = 'tUser_accounts' id = Column(Integer, Sequence('user_accounts_id_seq'), primary_key=True,nullable=False) nickname = Column(String(50), primary_key=True, nullable=False) description = Column(String(500)) password = Column(String) is_super_admin = Column(Boolean, default=False) max_simultaneous_conn = Column(Integer, default=5) privileges_roles_id = Column(String) # for privilege we can use an int in the used as a bitset later for an array of privilege class user_account_isp_link(__db_Base): __tablename__ = 'tUser_account_isp_links' link_id = Column(Integer, Sequence('tUser_account_isp_links_seq'), primary_key=True,nullable=False) user_account_id = Column(Integer, ForeignKey('tUser_accounts.id')) isp_id = Column(Integer, ForeignKey('tIsp.id')) note = Column(String(500)) isp_privilege_json = Column(String) contact_mail = Column(String(100)) contact_number = Column(String(100)) """ class user_account_role_link(__db_Base): __tablename__ = 'tUser_account_role_link' link_id = Column(Integer, Sequence('tUser_account_isp_links_seq'), primary_key=True,nullable=False) user_account_id = Column(Integer, ForeignKey('tUser_accounts.id')) role_id = Column(Integer, ForeignKey('tPrivilege_Role_Storage.id')) class Privilege_Role_Storage(__db_Base) : __tablename__ = 'tPrivilege_Role_Storage' id = Column(Integer, Sequence('Privilege_Role_Storage_seq'), primary_key=True,nullable=False) name = Column(String(50)) description = Column(String(500)) exclusive = Column(Boolean,default=False) domain_id = Column(Integer, ForeignKey('tPrivilege_Domain_Storage.id'), primary_key=True) aggregated_roles_id = Column(String) class Privilege_Domain_Storage(__db_Base) : __tablename__ = 'tPrivilege_Domain_Storage' id = Column(Integer, Sequence('Privilege_Domain_Storage_seq'), primary_key=True,nullable=False) name = Column(String(50), primary_key=True, nullable=False) description = Column(String(500)) """