Source code for cfxdb.user.schema
##############################################################################
#
# Crossbar.io Database
# Copyright (c) typedef int GmbH. Licensed under MIT.
#
##############################################################################
from .activation_token import ActivationToken
from .organization import Organization
from .user import User
from .user_mrealm_role import UserMrealmRole
[docs]
class Schema(object):
"""
user database schema for ZLMDB.
"""
def __init__(self, db):
[docs]
activation_tokens: ActivationToken
"""
CFC user activation tokens.
"""
[docs]
organizations: Organization
"""
CFC organization.
"""
"""
CFC users.
"""
[docs]
user_mrealm_roles: UserMrealmRole
"""
CFC user roles.
"""
@staticmethod
[docs]
def attach(db):
"""
Factory to create a schema from attaching to a database. The schema tables
will be automatically mapped as persistant maps and attached to the
database slots.
:param db: zlmdb.Database
:return: object of Schema
"""
schema = Schema(db)
schema.activation_tokens = db.attach_table(ActivationToken)
schema.organizations = db.attach_table(Organization)
schema.users = db.attach_table(User)
schema.user_mrealm_roles = db.attach_table(UserMrealmRole)
return schema