2018-04-27 17:16:43 +00:00
|
|
|
from distutils.version import StrictVersion
|
|
|
|
|
|
|
|
from ereuse_devicehub.resources.device import ComponentDef, ComputerDef, DesktopDef, DeviceDef, \
|
|
|
|
GraphicCardDef, HardDriveDef, LaptopDef, MicrotowerDef, MotherboardDef, NetbookDef, \
|
2018-05-11 16:58:48 +00:00
|
|
|
NetworkAdapterDef, ProcessorDef, RamModuleDef, ServerDef
|
2018-05-16 13:23:48 +00:00
|
|
|
from ereuse_devicehub.resources.event import AddDef, EventDef, RemoveDef, SnapshotDef, TestDef, \
|
|
|
|
TestHardDriveDef
|
2018-05-30 10:49:40 +00:00
|
|
|
from ereuse_devicehub.resources.tag import TagDef
|
|
|
|
from ereuse_devicehub.resources.user import OrganizationDef, UserDef
|
2018-04-10 15:06:39 +00:00
|
|
|
from teal.config import Config
|
|
|
|
|
|
|
|
|
|
|
|
class DevicehubConfig(Config):
|
2018-04-27 17:16:43 +00:00
|
|
|
RESOURCE_DEFINITIONS = (
|
2018-05-16 13:23:48 +00:00
|
|
|
DeviceDef, ComputerDef, DesktopDef, LaptopDef, NetbookDef, ServerDef,
|
|
|
|
MicrotowerDef, ComponentDef, GraphicCardDef, HardDriveDef, MotherboardDef,
|
2018-05-30 10:49:40 +00:00
|
|
|
NetworkAdapterDef, RamModuleDef, ProcessorDef, UserDef, OrganizationDef, TagDef, EventDef,
|
|
|
|
AddDef, RemoveDef, SnapshotDef, TestDef, TestHardDriveDef
|
2018-04-27 17:16:43 +00:00
|
|
|
)
|
|
|
|
PASSWORD_SCHEMES = {'pbkdf2_sha256'}
|
|
|
|
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/dh-db1'
|
2018-05-11 16:58:48 +00:00
|
|
|
MIN_WORKBENCH = StrictVersion('11.0')
|
2018-05-30 10:49:40 +00:00
|
|
|
"""
|
|
|
|
The minimum version of eReuse.org Workbench that this Devicehub
|
|
|
|
accepts. We recommend not changing this value.
|
|
|
|
"""
|
|
|
|
ORGANIZATION_NAME = None # type: str
|
|
|
|
ORGANIZATION_TAX_ID = None # type: str
|
|
|
|
"""
|
|
|
|
The organization using this Devicehub.
|
|
|
|
|
|
|
|
It is used by default, for example, when creating tags.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, db: str = None) -> None:
|
|
|
|
if not self.ORGANIZATION_NAME or not self.ORGANIZATION_TAX_ID:
|
|
|
|
raise ValueError('You need to set the main organization parameters.')
|
|
|
|
super().__init__(db)
|