isp_model.py 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. from sqlalchemy import Sequence, Column, Integer, String,ForeignKey,Boolean
  2. import persistence
  3. __db_Base = persistence.get_db_base()
  4. class isp(__db_Base) :
  5. __tablename__ = 'tIsp'
  6. id = Column(Integer, Sequence('isp_id_seq'), primary_key=True,nullable=False)
  7. name = Column(String(50))
  8. description = Column(String(500))
  9. class user_account(__db_Base) :
  10. __tablename__ = 'tUser_accounts'
  11. id = Column(Integer, Sequence('user_accounts_id_seq'), primary_key=True,nullable=False)
  12. nickname = Column(String(50), primary_key=True, nullable=False)
  13. description = Column(String(500))
  14. password = Column(String)
  15. is_super_admin = Column(Boolean, default=False)
  16. max_simultaneous_conn = Column(Integer, default=5)
  17. privileges_roles_id = Column(String)
  18. # for privilege we can use an int in the used as a bitset later for an array of privilege
  19. class user_account_isp_link(__db_Base):
  20. __tablename__ = 'tUser_account_isp_links'
  21. link_id = Column(Integer, Sequence('tUser_account_isp_links_seq'), primary_key=True,nullable=False)
  22. user_account_id = Column(Integer, ForeignKey('tUser_accounts.id'))
  23. isp_id = Column(Integer, ForeignKey('tIsp.id'))
  24. note = Column(String(500))
  25. isp_privilege_json = Column(String)
  26. contact_mail = Column(String(100))
  27. contact_number = Column(String(100))
  28. """
  29. class user_account_role_link(__db_Base):
  30. __tablename__ = 'tUser_account_role_link'
  31. link_id = Column(Integer, Sequence('tUser_account_isp_links_seq'), primary_key=True,nullable=False)
  32. user_account_id = Column(Integer, ForeignKey('tUser_accounts.id'))
  33. role_id = Column(Integer, ForeignKey('tPrivilege_Role_Storage.id'))
  34. class Privilege_Role_Storage(__db_Base) :
  35. __tablename__ = 'tPrivilege_Role_Storage'
  36. id = Column(Integer, Sequence('Privilege_Role_Storage_seq'), primary_key=True,nullable=False)
  37. name = Column(String(50))
  38. description = Column(String(500))
  39. exclusive = Column(Boolean,default=False)
  40. domain_id = Column(Integer, ForeignKey('tPrivilege_Domain_Storage.id'), primary_key=True)
  41. aggregated_roles_id = Column(String)
  42. class Privilege_Domain_Storage(__db_Base) :
  43. __tablename__ = 'tPrivilege_Domain_Storage'
  44. id = Column(Integer, Sequence('Privilege_Domain_Storage_seq'), primary_key=True,nullable=False)
  45. name = Column(String(50), primary_key=True, nullable=False)
  46. description = Column(String(500))
  47. """