access.py 570 Bytes
Newer Older
1 2
# -*- coding: utf-8 -*-
""" access
3

4 5
    Define constants for the different role.
    Access to the databases.
6

7
"""
LE GAC Renaud's avatar
LE GAC Renaud committed
8
# Migration flags
9
MIGRATE = False
LE GAC Renaud's avatar
LE GAC Renaud committed
10
MIGRATE_USER = False
11

12
# Roles
13 14
ID_ADMIN, ADMIN, DEF_ADMIN = 1, 'admin', 'administrators, librairians,...'
ID_USER, USER, DEF_USER = 2, 'user', 'liaisons, team leaders,...'
15

16
# MYSQL database
LE GAC Renaud's avatar
LE GAC Renaud committed
17
try:
18
    mysql = DBURIS[request.application]
19
    db = DAL(mysql, lazy_tables=False, migrate_enabled=MIGRATE, pool_size=10)
LE GAC Renaud's avatar
LE GAC Renaud committed
20 21
except:
    raise HTTP(500, T("Can't access the MySQL database !!!"))
22

23 24
# virtual database
virtdb = DAL(None)