diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-02-17 10:17:22 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-02-17 10:17:22 -0500 |
commit | def523b611809f6cda7ad716420f228bb86c924c (patch) | |
tree | c2bb179889babfbaf87f8bd0cec451f3c3108117 /web/react | |
parent | 6ffcfaa2f38cfb4d4f354c547286d8e29b6efda6 (diff) | |
parent | 6bc1e3c5ca948b42c39d3ff140c72d978de3c7a1 (diff) | |
download | chat-def523b611809f6cda7ad716420f228bb86c924c.tar.gz chat-def523b611809f6cda7ad716420f228bb86c924c.tar.bz2 chat-def523b611809f6cda7ad716420f228bb86c924c.zip |
Merge pull request #2176 from rgarmsen2295/plt-1870
PLT-1870 Added license audit parsing to the audit table
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/audit_table.jsx | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/web/react/components/audit_table.jsx b/web/react/components/audit_table.jsx index 49892ff98..31d04f19b 100644 --- a/web/react/components/audit_table.jsx +++ b/web/react/components/audit_table.jsx @@ -183,6 +183,26 @@ const holders = defineMessages({ loginFailure: { id: 'audit_table.loginFailure', defaultMessage: ' (Login failure)' + }, + attemptedLicenseAdd: { + id: 'audit_table.attemptedLicenseAdd', + defaultMessage: 'Attempted to add new license' + }, + successfullLicenseAdd: { + id: 'audit_table.successfullLicenseAdd', + defaultMessage: 'Successfully added new license' + }, + failedExpiredLicenseAdd: { + id: 'audit_table.failedExpiredLicenseAdd', + defaultMessage: 'Failed to add a new license as it has either expired or not yet been started' + }, + failedInvalidLicenseAdd: { + id: 'audit_table.failedInvalidLicenseAdd', + defaultMessage: 'Failed to add an invalid license' + }, + licenseRemoved: { + id: 'audit_table.licenseRemoved', + defaultMessage: 'Successfully removed a license' } }); @@ -327,17 +347,17 @@ export function formatAuditInfo(audit, formatMessage) { switch (actionURL) { case '/channels/create': - auditDesc = formatMessage(holders.channelCreated, {channelName: channelName}); + auditDesc = formatMessage(holders.channelCreated, {channelName}); break; case '/channels/create_direct': auditDesc = formatMessage(holders.establishedDM, {username: Utils.getDirectTeammate(channelObj.id).username}); break; case '/channels/update': - auditDesc = formatMessage(holders.nameUpdated, {channelName: channelName}); + auditDesc = formatMessage(holders.nameUpdated, {channelName}); break; case '/channels/update_desc': // support the old path case '/channels/update_header': - auditDesc = formatMessage(holders.headerUpdated, {channelName: channelName}); + auditDesc = formatMessage(holders.headerUpdated, {channelName}); break; default: { let userIdField = []; @@ -356,9 +376,9 @@ export function formatAuditInfo(audit, formatMessage) { if (/\/channels\/[A-Za-z0-9]+\/delete/.test(actionURL)) { auditDesc = formatMessage(holders.channelDeleted, {url: channelURL}); } else if (/\/channels\/[A-Za-z0-9]+\/add/.test(actionURL)) { - auditDesc = formatMessage(holders.userAdded, {username: username, channelName: channelName}); + auditDesc = formatMessage(holders.userAdded, {username, channelName}); } else if (/\/channels\/[A-Za-z0-9]+\/remove/.test(actionURL)) { - auditDesc = formatMessage(holders.userRemoved, {username: username, channelName: channelName}); + auditDesc = formatMessage(holders.userRemoved, {username, channelName}); } break; @@ -495,25 +515,25 @@ export function formatAuditInfo(audit, formatMessage) { break; } } else if (actionURL.indexOf('/hooks') === 0) { - const webhookInfo = audit.extra_info.split(' '); + const webhookInfo = audit.extra_info; switch (actionURL) { case '/hooks/incoming/create': - if (webhookInfo[0] === 'attempt') { + if (webhookInfo === 'attempt') { auditDesc = formatMessage(holders.attemptedWebhookCreate); - } else if (webhookInfo[0] === 'success') { + } else if (webhookInfo === 'success') { auditDesc = formatMessage(holders.succcessfullWebhookCreate); - } else if (webhookInfo[0] === 'fail - bad channel permissions') { + } else if (webhookInfo === 'fail - bad channel permissions') { auditDesc = formatMessage(holders.failedWebhookCreate); } break; case '/hooks/incoming/delete': - if (webhookInfo[0] === 'attempt') { + if (webhookInfo === 'attempt') { auditDesc = formatMessage(holders.attemptedWebhookDelete); - } else if (webhookInfo[0] === 'success') { + } else if (webhookInfo === 'success') { auditDesc = formatMessage(holders.successfullWebhookDelete); - } else if (webhookInfo[0] === 'fail - inappropriate conditions') { + } else if (webhookInfo === 'fail - inappropriate conditions') { auditDesc = formatMessage(holders.failedWebhookDelete); } @@ -521,6 +541,28 @@ export function formatAuditInfo(audit, formatMessage) { default: break; } + } else if (actionURL.indexOf('/license') === 0) { + const licenseInfo = audit.extra_info; + + switch (actionURL) { + case '/license/add': + if (licenseInfo === 'attempt') { + auditDesc = formatMessage(holders.attemptedLicenseAdd); + } else if (licenseInfo === 'success') { + auditDesc = formatMessage(holders.successfullLicenseAdd); + } else if (licenseInfo === 'failed - expired or non-started license') { + auditDesc = formatMessage(holders.failedExpiredLicenseAdd); + } else if (licenseInfo === 'failed - invalid license') { + auditDesc = formatMessage(holders.failedInvalidLicenseAdd); + } + + break; + case '/license/remove': + auditDesc = formatMessage(holders.licenseRemoved); + break; + default: + break; + } } else { switch (actionURL) { case '/logout': |