Esempio n. 1
0
def delete_old():
    logger.info("Deleting old records")
    connection = get_connection()
    result = connection.execute(radacct.delete().where(and_(
        radacct.c.acctstoptime < utcnow() - app.conf["HADES_RETENTION_INTERVAL"]
    )))
    result = connection.execute(radpostauth.delete().where(and_(
        radpostauth.c.authdate < utcnow() - timedelta(days=1)
    )))
Esempio n. 2
0
def get_sessions(self, mac):
    connection = get_connection()
    results = connection.execute(
        select([radacct.c.nasipaddress, radacct.c.nasportid,
                radacct.c.acctstarttime, radacct.c.acctstoptime,
                radacct.c.acctstartdelay, radacct.c.acctstopdelay])
        .where(and_(radacct.c.username == mac,
                    radacct.c.acctstarttime >= utcnow() - timedelta(days=1))))
    return results.fetchall()