DBC Audit trail module for JS
installation
npm i @dbcdk/dbc-audittrail-logger
Methods & Parameters
The main method is auditTrace
. It takes the following arguments:
-
action:string
: read|write|login -
appName:string
: identifier of application -
clientIps:array
: list of client ips -
accessingUser:object
: identifier for user accessing data. Most often in the form{login_token: 'some-valid-token'}
but can also be a login{login: 'user-id', group: 'netpunkt'}
-
owningUser:string
: String that can identify the user owning the data -
accessInfo:object
: accessed information
Actions kan be retrieved as a constant from ACTIONS
. Values are read|write|login
.
Usage
import {auditTrace, ACTIONS} from '@dbcdk/dbc-audittrail-logger';
const applicationName = 'bibliotekdk';
const ips = ['10.10.10.0']; // if using express you can retrieve the list through req.ips()
const owning_user = '1234561010';
const accessing_user = {
login_token: 'some-valid-token',
};
const accessInfo = {
loan: '12345',
};
auditTrace(
ACTIONS.read,
applicationName,
ips,
accessing_user,
owning_user,
accessInfo
);
Test
npm run test