Beispiel #1
0
class CmsMenuStructure(sql.SQLTable):
    """Language independent menu structure."""
    name = 'cms_menu_structure'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('menu_item_id', pytis.data.Serial()),
        sql.Column('identifier',
                   pytis.data.String(maxlen=32, not_null=True),
                   unique=True),
        sql.Column('parent',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_menu_structure')),
        sql.Column('mod_id',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_modules')),
        sql.Column('ord', pytis.data.Integer(not_null=True)),
        sql.Column('tree_order', pytis.data.LTree(not_null=False)),
    )
    index_columns = (  #('ord', sqlalchemy.literal_column('coalesce(parent, 0)'),),
        (
            'parent',
            'ord',
        ), )
    with_oids = True
    depends_on = (CmsModules, )
    access_rights = cms_rights.value(globals())
Beispiel #2
0
class CmsMenuTexts(sql.SQLTable):
    """Language dependent texts and properties for menu items."""
    name = 'cms_menu_texts'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.Column('menu_item_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA('cms_menu_structure',
                                     ondelete='CASCADE')),
        sql.Column('lang',
                   pytis.data.String(minlen=2, maxlen=2, not_null=True),
                   references=sql.gA('cms_languages(lang)',
                                     ondelete='CASCADE')),
        sql.Column('published',
                   pytis.data.Boolean(not_null=True),
                   default='TRUE'),
        sql.Column('title', pytis.data.String(not_null=True)),
        sql.Column('heading', pytis.data.String(not_null=False)),
        sql.Column('description', pytis.data.String(not_null=False)),
        sql.Column('content', pytis.data.String(not_null=False)),
    )
    with_oids = True
    depends_on = (
        CmsMenuStructure,
        CmsLanguages,
    )
    access_rights = cms_rights.value(globals())
Beispiel #3
0
class CmsSessionLogData(sql.SQLTable):
    """Log of web user logins (underlying data)."""
    name = 'cms_session_log_data'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('log_id', pytis.data.Serial()),
        sql.Column('session_id',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_session', ondelete='SET NULL')),
        sql.Column('uid',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA(cms_users_table.value(globals()),
                                     ondelete='CASCADE')),
        sql.Column('login', pytis.data.String(not_null=True)),
        sql.Column('success', pytis.data.Boolean(not_null=True),
                   default=False),
        sql.Column('start_time', pytis.data.DateTime(not_null=True)),
        sql.Column('end_time', pytis.data.DateTime(not_null=False)),
        sql.Column('ip_address', pytis.data.String(not_null=True)),
        sql.Column('user_agent', pytis.data.String(not_null=False)),
        sql.Column('referer', pytis.data.String(not_null=False)),
    )
    with_oids = True
    depends_on = ()
    access_rights = cms_rights_rw.value(globals())
Beispiel #4
0
class CmsRightsAssignment(sql.SQLTable):
    """Underlying binding table between menu items, roles and module actions."""
    name = 'cms_rights_assignment'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('rights_assignment_id', pytis.data.Serial()),
        sql.Column('menu_item_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA('cms_menu_structure',
                                     ondelete='CASCADE')),
        sql.Column('role_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA('cms_roles', ondelete='CASCADE')),
        sql.Column('action_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA('cms_actions', ondelete='CASCADE')),
    )
    with_oids = True
    unique = ((
        'menu_item_id',
        'role_id',
        'action_id',
    ), )
    depends_on = (
        CmsMenuStructure,
        CmsRoles,
        CmsActions,
    )
    access_rights = cms_rights.value(globals())
Beispiel #5
0
class CmsActions(sql.SQLTable):
    """Enumeration of valid actions.
    (Including both module independent actions and per module actions.)
    Module independent actions have NULL in the mod_id column.
    """
    name = '_cms_actions'
    external = True
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('action_id', pytis.data.Serial()),
        sql.Column('mod_id',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_modules', ondelete='CASCADE')),
        sql.Column('name', pytis.data.String(maxlen=16, not_null=True)),
        sql.Column('description', pytis.data.String(not_null=True)),
    )
    unique = ((
        'mod_id',
        'name',
    ), )
    depends_on = (CmsModules, )
    access_rights = cms_rights.value(globals())
    init_columns = ('name', 'description')
    init_values = (
        ('visit', 'Display the item content'),
        ('show', 'See the item in the menu'),
    )
Beispiel #6
0
class CmsUserRoleAssignment(sql.SQLTable):
    """Binding table assigning CMS roles to CMS users."""
    name = 'cms_user_role_assignment'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('user_role_id', pytis.data.Serial()),
        sql.Column('uid',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA(cms_users_table.value(globals()),
                                     ondelete='CASCADE')),
        sql.Column('role_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA('cms_roles', ondelete='CASCADE')),
    )
    with_oids = True
    unique = ((
        'uid',
        'role_id',
    ), )
    depends_on = (CmsRoles, )
    access_rights = cms_rights.value(globals())
Beispiel #7
0
class CmsSession(sql.SQLTable):
    """Web user session information for authentication and login history."""
    name = 'cms_session'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('session_id', pytis.data.Serial()),
        sql.Column('uid',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA(cms_users_table.value(globals()),
                                     ondelete='CASCADE')),
        sql.Column('session_key', pytis.data.String(not_null=True)),
        sql.Column('last_access', pytis.data.DateTime(not_null=True)),
    )
    unique = ((
        'uid',
        'session_key',
    ), )
    depends_on = ()
    access_rights = cms_rights_rw.value(globals())
Beispiel #8
0
class CmsAccessLogData(sql.SQLTable):
    """Log of cms page access."""
    name = 'cms_access_log_data'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('log_id', pytis.data.Serial()),
        sql.Column('timestamp', pytis.data.DateTime(not_null=True)),
        sql.Column('uri', pytis.data.String(not_null=True)),
        sql.Column('uid',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA(cms_users_table.value(globals()),
                                     ondelete='CASCADE')),
        sql.Column('modname', pytis.data.String(not_null=False)),
        sql.Column('action', pytis.data.String(not_null=False)),
        sql.Column('ip_address', pytis.data.String(not_null=True)),
        sql.Column('user_agent', pytis.data.String(not_null=False)),
        sql.Column('referer', pytis.data.String(not_null=False)),
    )
    with_oids = True
    depends_on = ()
    access_rights = cms_rights_rw.value(globals())
Beispiel #9
0
class CmsActions(sql.SQLTable):
    """Enumeration of valid actions.
    (Including both module independent actions and per module actions.)
    Module independent actions have NULL in the mod_id column.
    """
    name = 'cms_actions'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('action_id', pytis.data.Serial()),
        sql.Column('mod_id',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_modules', ondelete='CASCADE')),
        sql.Column('name', pytis.data.String(maxlen=16, not_null=True)),
        sql.Column('description', pytis.data.String(not_null=True)),
    )
    with_oids = True
    unique = ((
        'mod_id',
        'name',
    ), )
    depends_on = (CmsModules, )
    access_rights = cms_rights.value(globals())