Beispiel #1
0
def get_all(data, db_session, username):
    logger.info(LogMsg.START, username)
    if data.get('sort') is None:
        data['sort'] = ['creation_date-']

    permissions, presses = get_user_permissions(username, db_session)
    has_permission([Permissions.PAYMENT_GET_PREMIUM], permissions)
    logger.debug(LogMsg.PERMISSION_VERIFIED)

    result = Payment.mongoquery(
        db_session.query(Payment)).query(**data).end().all()

    logger.info(LogMsg.END)
    return result
def get_all(data, db_session, username):
    logger.info(LogMsg.START, username)
    if data.get('sort') is None:
        data['sort'] = ['creation_date-']

    logger.debug(LogMsg.PERMISSION_CHECK, username)
    validate_permissions_and_access(username,
                                    db_session,
                                    'PAYMENT_GET',
                                    access_level=Access_level.Premium)
    logger.debug(LogMsg.PERMISSION_VERIFIED, username)

    result = Payment.mongoquery(
        db_session.query(Payment)).query(**data).end().all()

    logger.info(LogMsg.END)
    return result