예제 #1
0
def setup_security(app, permissions=None):
    # setup dummy auth and identity
    ident_policy = DummyTokenIdentityPolicy()
    auth_policy = DummyAuthPolicy(username="******",
                                  password="******",
                                  permissions=permissions)
    aiohttp_security.setup(app, ident_policy, auth_policy)
예제 #2
0
def setup_admin(app, pg, admin_config_path):
    admin_config_path = str(PROJ_ROOT / 'static' / 'js')
    resources = (PGResource(pg, db.question, url='question'),
                 PGResource(pg, db.choice, url='choice'))
    admin = aiohttp_admin.setup(app, admin_config_path, resources=resources)

    # setup dummy auth and identity
    ident_policy = DummyTokenIdentityPolicy()
    auth_policy = DummyAuthPolicy(username="******", password="******")
    aiohttp_security.setup(admin, ident_policy, auth_policy)
    return admin
예제 #3
0
def setup_admin(app, mongo):
    admin_config_path = str(PROJ_ROOT / 'static' / 'js')
    m = mongo
    resources = (MotorResource(m.user, db.user, url="user"),
                 MotorResource(m.message, db.message, url="message"),
                 MotorResource(m.follower, db.follower, url="follower"))
    admin = aiohttp_admin.setup(app, admin_config_path, resources=resources)

    # setup dummy auth and identity
    ident_policy = DummyTokenIdentityPolicy()
    auth_policy = DummyAuthPolicy(username="******", password="******")
    aiohttp_security.setup(admin, ident_policy, auth_policy)
    return admin
예제 #4
0
def setup_admin(app, pg):
    admin = aiohttp_admin._setup(
        app,
        title='Blog admin',
        schema=schema,
        db=pg,
    )

    # setup dummy auth and identity
    ident_policy = DummyTokenIdentityPolicy()
    auth_policy = DummyAuthPolicy(username="******", password="******")
    aiohttp_security.setup(admin, ident_policy, auth_policy)

    app.add_subapp('/admin/', admin)
예제 #5
0
def setup_admin(app, pg):
    admin = aiohttp_admin._setup(
        app,
        title='Files admin',
        schema=schema,
        db=pg,
    )

    # setup dummy auth and identity
    ident_policy = DummyTokenIdentityPolicy()
    auth_policy = DummyAuthPolicy(username=app['config']['aiohttp-admin']['user'],
                                  password=app['config']['aiohttp-admin']['password'])
    aiohttp_security.setup(admin, ident_policy, auth_policy)

    app.add_subapp('/admin', admin)