audit changes
This commit is contained in:
parent
176fe16b2f
commit
eadab90340
@ -7,4 +7,6 @@ export enum AuditAction {
|
|||||||
EMAIL_CHANGE = 'email_change',
|
EMAIL_CHANGE = 'email_change',
|
||||||
MALICIOUS_REQUEST = 'malicious_request',
|
MALICIOUS_REQUEST = 'malicious_request',
|
||||||
THROTTLE = 'throttle',
|
THROTTLE = 'throttle',
|
||||||
|
DEACTIVATION_REQUEST = 'deactivation_request',
|
||||||
|
DATA_DOWNLOAD_REQUEST = 'data_download_request',
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,12 @@ import { AuditSearchClause, UserLoginEntry } from './audit.interfaces';
|
|||||||
|
|
||||||
const PLUCK_LOCATION = ['country', 'city', 'timezone', 'll'];
|
const PLUCK_LOCATION = ['country', 'city', 'timezone', 'll'];
|
||||||
const PLUCK_USER_AGENT = ['browser', 'version', 'os', 'platform'];
|
const PLUCK_USER_AGENT = ['browser', 'version', 'os', 'platform'];
|
||||||
|
const AUTOFLAG = [
|
||||||
|
AuditAction.MALICIOUS_REQUEST,
|
||||||
|
AuditAction.THROTTLE,
|
||||||
|
AuditAction.DEACTIVATION_REQUEST,
|
||||||
|
AuditAction.DATA_DOWNLOAD_REQUEST,
|
||||||
|
];
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuditService {
|
export class AuditService {
|
||||||
@ -40,10 +46,7 @@ export class AuditService {
|
|||||||
audit.actor_ua = ua;
|
audit.actor_ua = ua;
|
||||||
audit.actor = user;
|
audit.actor = user;
|
||||||
|
|
||||||
if (
|
if (AUTOFLAG.includes(action)) {
|
||||||
action === AuditAction.MALICIOUS_REQUEST ||
|
|
||||||
action === AuditAction.THROTTLE
|
|
||||||
) {
|
|
||||||
audit.flagged = true;
|
audit.flagged = true;
|
||||||
// TODO: email administrator
|
// TODO: email administrator
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user