access.py 1 KB
Newer Older
1 2
from gluon.tools import Auth

3
DB_MYSQL = 'mysql://GesProd:Prod_CPPM@maretude.in2p3.fr/GesProd'
4 5 6 7 8

#
# Main database
#
try:
9
    db = DAL(DB_MYSQL, migrate=False, pool_size=10)
10 11 12 13 14 15
except:
    raise HTTP(500, T("Can't access the MySQL database !!!"))

#db = DAL('sqlite://storage.sqlite', migrate=True)

#
16
# Logging
17
#
18
#
19 20
auth = Auth(db, hmac_key=Auth.get_or_create_key())

21
auth.define_tables(migrate=False)
22 23 24
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = True
auth.settings.remember_me_form = False
25
auth.settings.reset_password_requires_verification = True
26 27 28 29 30 31 32 33 34 35 36 37 38 39


# tune authentification fields for the extJS interface
db.auth_user.registration_key.readable = True
db.auth_user.registration_key.writable = True

db.auth_membership.user_id.label = 'User'
db.auth_membership.group_id.label = 'Group'

db.auth_membership.user_id.requires = \
IS_IN_DB(db, 'auth_user.id', 'auth_user.last_name')

db.auth_membership.group_id.requires = \
IS_IN_DB(db, 'auth_group.id', 'auth_group.role')