audit changes
This commit is contained in:
parent
176fe16b2f
commit
eadab90340
@ -7,4 +7,6 @@ export enum AuditAction {
|
||||
EMAIL_CHANGE = 'email_change',
|
||||
MALICIOUS_REQUEST = 'malicious_request',
|
||||
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_USER_AGENT = ['browser', 'version', 'os', 'platform'];
|
||||
const AUTOFLAG = [
|
||||
AuditAction.MALICIOUS_REQUEST,
|
||||
AuditAction.THROTTLE,
|
||||
AuditAction.DEACTIVATION_REQUEST,
|
||||
AuditAction.DATA_DOWNLOAD_REQUEST,
|
||||
];
|
||||
|
||||
@Injectable()
|
||||
export class AuditService {
|
||||
@ -40,10 +46,7 @@ export class AuditService {
|
||||
audit.actor_ua = ua;
|
||||
audit.actor = user;
|
||||
|
||||
if (
|
||||
action === AuditAction.MALICIOUS_REQUEST ||
|
||||
action === AuditAction.THROTTLE
|
||||
) {
|
||||
if (AUTOFLAG.includes(action)) {
|
||||
audit.flagged = true;
|
||||
// TODO: email administrator
|
||||
}
|
||||
|
Reference in New Issue
Block a user