linotp.lib.reporting module

class linotp.lib.reporting.ReportingIterator(page=None, psize=None, sort=None, sortdir=None, realms=None, status=None, date=None)

Bases: object

support a smooth iterating through lines in reporting table

getResultSetInfo()
iterate_reports()
linotp.lib.reporting.delete(realms, status, date=None)

delete all rows in reporting database before a given date, filtered by realm and status

Parameters
  • realms – the ralm to filter

  • status – the status to filter

  • date (string in format: 'yyyy-mm-dd') – (optional) day until which all rows will be deleted

Returns

number of deleted rows

linotp.lib.reporting.get_last_token_count_before_date(realm, before_date=None, status='active')

Search for latest reporting entry that were set before the given date.

Parameters
  • realm – (required) the realm in which we are searching

  • before_date – (required) timestamp evaluate all entries before the given date

  • status – (default: ‘active’) the status that the tokens should have

Returns

counter: token count from the reporting event with given status in realm or None

linotp.lib.reporting.get_max_token_count_in_period(realm, start=None, end=None, status='active')

Search for the maximum token count value in the reporing events in a period with the status and realm.

Parameters
  • realm – (required) the realm in which we are searching

  • start – timestamp (default: 1.1.1970) the reporting start, including the given date

  • end – timestamp (default: tomorrow) the reporting end, excluding the given date

  • status – (default: ‘active’) the status that the tokens have default is ‘active’ as this is relevant for license

Returns

maximum: number of reported tokens with given status in realm

linotp.lib.reporting.token_reporting(event, tokenrealms)

log token events into reporting table

Parameters
  • event – the event that happened, e.g. init token, delete token

  • tokenrealms – the realm on which the event happened

Returns

nothing