Beispiel #1
0
# coding: utf8
if False:
    from gluon import *
    from gluon.tools import request,response, session, cache, Auth, DAL

    db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
    auth=Auth(db)
#from plugin_lazy_options_widget import lazy_options_widget
from plugin_suggest_widget import suggest_widget
from cascadedrop import CascadingSelect
from gluon.contrib.populate import populate


db.define_table('school',
                Field('name', requires=IS_NOT_EMPTY()),
                auth.signature,
                format='%(name)s'
                )


db.define_table('department',
                Field('school', db.school), #, requires=IS_IN_DB(db, db.school.id, '%(name)s')),
                Field('name', requires=IS_NOT_EMPTY()),
                Field('HOD', 'reference auth_user'),
                auth.signature,
                format='%(name)s'
                )
db.define_table('program',
                Field('department', 'reference department'),
                Field('classification', requires=IS_IN_SET(['ND', 'HND', 'PRE-ND', 'PGD','NON-ND'])),
                Field('the_option', label='Option'),
Beispiel #2
0
## configure email
mail = Mail()
mail.settings.server = settings.email_server
mail.settings.sender = settings.email_sender
mail.settings.login = settings.email_login

## configure auth policy
url_index = URL('default', 'index')
auth = Auth(db, hmac_key=settings.security_key, controller='users', function='index')

#########################################
db.define_table('clsb_country',
    Field('country_name', type = 'string', notnull = True, default = "Viet Nam",
          label = T('Country name')),
    Field('country_code', type = 'string', default = "84", unique = True, notnull = True,
          label = T('Country code')),
    Field('description', type = 'text',
          label = T('Description')),
    auth.signature,
    format='%(country_name)s')

#########################################
db.define_table('clsb_province',
    Field('province_name', type = 'string', notnull = True,
          label = T('Province name')),
    Field('country_id', type = 'reference clsb_country', notnull = True,
          label = T('Country id')),
    Field('province_code', type = 'string', unique = True, notnull = True,
          label = T('Province code')),
    Field('description', type = 'text',
          label = T('Description')),
Beispiel #3
0
    myconf = AppConfig(reload=True)
    db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all'])
    auth = Auth(db)
    service = Service()
    plugins = PluginManager()
    from db import *

    ## create all tables needed by auth if not custom tables
    #auth.define_tables(username=False, signature=False)
from time import ctime

db.define_table('rev_wallet',
                Field('revnumber', requires=IS_LENGTH(16, 16)),
                Field('month_issued', 'integer', requires=IS_INT_IN_RANGE(1, 12)),
                Field('year_issued', 'integer', requires=IS_INT_IN_RANGE(2015, 2099)),
                Field('month_expired', 'integer', requires=IS_INT_IN_RANGE(1, 12)),
                Field('year_expired', 'integer', requires=IS_INT_IN_RANGE(2015, 2099)),
                Field('amount', 'float'),

                )
db.define_table('device',
                Field('name'),
                Field('deviceuid'),
                Field('assigned_to','reference auth_user'),
                )
db.define_table('payer',
                Field('surname'),
                Field('firstname'),
                Field('sex', requires=IS_IN_SET(['Male', 'Female'])),
                Field('wallet', 'reference rev_wallet')
Beispiel #4
0
                except:
                    # print auth.user.token
                    # import traceback
                    # traceback.print_exc()
                    pass
                finally:
                    if "result" in res and res["result"] is True:
                        return action(*a, **b)
            if request.is_restful:
                raise HTTP(401)
            else:
                return dict(error="You don't have permission to access!")
                # session.flash = "You don't have permission to access!"
                # redirect(URL(c='default', f='index'))
        f.__doc__ = action.__doc__
        f.__name__ = action.__name__
        f.__dict__.update(action.__dict__)
        return f
    return decorate
auth.requires_authorize = __authorize


db.define_table('clsb_config',
                Field('config_key', type='string', unique=True, notnull=True),
                Field('config_value', type='text'))
db.define_table('clsb20_encrypt_product',
                Field('product_code', type='string', unique=True, notnull=True),
                Field('product_path', type='string', notnull=True),
                Field('status', type='string', notnull=True, default='PENDING',
                      requires=IS_IN_SET(['PENDING', 'ENCRYPTING'], zero = None)))