diff options
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/components/admin_console/admin_controller.jsx | 3 | ||||
-rw-r--r-- | webapp/components/admin_console/admin_sidebar.jsx | 17 | ||||
-rw-r--r-- | webapp/components/admin_console/audits.jsx | 55 | ||||
-rw-r--r-- | webapp/components/audit_table.jsx | 9 | ||||
-rw-r--r-- | webapp/i18n/en.json | 35 | ||||
-rw-r--r-- | webapp/sass/routes/_admin-console.scss | 20 | ||||
-rw-r--r-- | webapp/stores/admin_store.jsx | 30 | ||||
-rw-r--r-- | webapp/utils/async_client.jsx | 26 | ||||
-rw-r--r-- | webapp/utils/client.jsx | 29 | ||||
-rw-r--r-- | webapp/utils/constants.jsx | 1 |
10 files changed, 199 insertions, 26 deletions
diff --git a/webapp/components/admin_console/admin_controller.jsx b/webapp/components/admin_console/admin_controller.jsx index e4a4e28fc..aea2a0197 100644 --- a/webapp/components/admin_console/admin_controller.jsx +++ b/webapp/components/admin_console/admin_controller.jsx @@ -23,6 +23,7 @@ import LegalAndSupportSettingsTab from './legal_and_support_settings.jsx'; import TeamUsersTab from './team_users.jsx'; import TeamAnalyticsTab from '../analytics/team_analytics.jsx'; import LdapSettingsTab from './ldap_settings.jsx'; +import ComplianceSettingsTab from './compliance_settings.jsx'; import LicenseSettingsTab from './license_settings.jsx'; import SystemAnalyticsTab from '../analytics/system_analytics.jsx'; @@ -159,6 +160,8 @@ export default class AdminController extends React.Component { tab = <LegalAndSupportSettingsTab config={this.state.config}/>; } else if (this.state.selected === 'ldap_settings') { tab = <LdapSettingsTab config={this.state.config}/>; + } else if (this.state.selected === 'compliance_settings') { + tab = <ComplianceSettingsTab config={this.state.config}/>; } else if (this.state.selected === 'license') { tab = <LicenseSettingsTab config={this.state.config}/>; } else if (this.state.selected === 'team_users') { diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx index 27d4a4112..8ee75e2ef 100644 --- a/webapp/components/admin_console/admin_sidebar.jsx +++ b/webapp/components/admin_console/admin_sidebar.jsx @@ -171,6 +171,7 @@ export default class AdminSidebar extends React.Component { } let ldapSettings; + let complianceSettings; let licenseSettings; if (global.window.mm_config.BuildEnterpriseReady === 'true') { if (global.window.mm_license.IsLicensed === 'true') { @@ -188,6 +189,21 @@ export default class AdminSidebar extends React.Component { </a> </li> ); + + complianceSettings = ( + <li> + <a + href='#' + className={this.isSelected('compliance_settings')} + onClick={this.handleClick.bind(this, 'compliance_settings', null)} + > + <FormattedMessage + id='admin.sidebar.compliance' + defaultMessage='Compliance Settings' + /> + </a> + </li> + ); } licenseSettings = ( @@ -381,6 +397,7 @@ export default class AdminSidebar extends React.Component { </a> </li> {ldapSettings} + {complianceSettings} <li> <a href='#' diff --git a/webapp/components/admin_console/audits.jsx b/webapp/components/admin_console/audits.jsx index 28503d783..1f94de7da 100644 --- a/webapp/components/admin_console/audits.jsx +++ b/webapp/components/admin_console/audits.jsx @@ -3,6 +3,7 @@ import LoadingScreen from '../loading_screen.jsx'; import AuditTable from '../audit_table.jsx'; +import ComplianceReports from './compliance_reports.jsx'; import AdminStore from 'stores/admin_store.jsx'; @@ -60,36 +61,40 @@ export default class Audits extends React.Component { } else { content = ( <div style={{margin: '10px'}}> - <AuditTable - audits={this.state.audits} - showUserId={true} - showIp={true} - showSession={true} - /> + <AuditTable + audits={this.state.audits} + showUserId={true} + showIp={true} + showSession={true} + /> </div> ); } return ( - <div className='panel'> - <h3> - <FormattedMessage - id='admin.audits.title' - defaultMessage='User Activity' - /> - </h3> - <button - type='submit' - className='btn btn-primary' - onClick={this.reload} - > - <FormattedMessage - id='admin.audits.reload' - defaultMessage='Reload' - /> - </button> - <div className='log__panel'> - {content} + <div> + <ComplianceReports/> + + <div className='panel'> + <h3> + <FormattedMessage + id='admin.audits.title' + defaultMessage='User Activity' + /> + </h3> + <button + type='submit' + className='btn btn-primary' + onClick={this.reload} + > + <FormattedMessage + id='admin.audits.reload' + defaultMessage='Reload' + /> + </button> + <div className='audit__panel'> + {content} + </div> </div> </div> ); diff --git a/webapp/components/audit_table.jsx b/webapp/components/audit_table.jsx index 73dcfccc3..abf09dfaf 100644 --- a/webapp/components/audit_table.jsx +++ b/webapp/components/audit_table.jsx @@ -219,7 +219,12 @@ class AuditTable extends React.Component { let uContent; if (this.props.showUserId) { - uContent = <td>{auditInfo.userId}</td>; + var profile = UserStore.getProfile(auditInfo.userId); + if (profile) { + uContent = <td>{profile.email}</td>; + } else { + uContent = <td>{auditInfo.userId}</td>; + } } let iContent; @@ -562,6 +567,8 @@ export function formatAuditInfo(audit, formatMessage) { default: break; } + } else if (actionURL.indexOf('/admin/download_compliance_report') === 0) { + auditDesc = Utils.toTitleCase(audit.extra_info); } else { switch (actionURL) { case '/logout': diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index bb1f05c23..437271633 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -191,6 +191,40 @@ "admin.ldap.uernameAttrDesc": "The attribute in the LDAP server that will be used to populate the username field in Mattermost. This may be the same as the ID Attribute.", "admin.ldap.usernameAttrEx": "Ex \"sAMAccountName\"", "admin.ldap.usernameAttrTitle": "Username Attribute:", + "admin.compliance.saving": "Saving Config...", + "admin.compliance.directoryExample": "Ex \"./data/\"", + "admin.compliance.noLicense": "<h4 class=\"banner__heading\">Note:</h4><p>Compliance is an enterprise feature. Your current license does not support Compliance. Click <a href=\"http://mattermost.com\" target=\"_blank\">here</a> for information and pricing on enterprise licenses.</p>", + "admin.compliance.title": "Compliance Settings", + "admin.compliance.enableTitle": "Enable Compliance:", + "admin.compliance.true": "true", + "admin.compliance.false": "false", + "admin.compliance.enableDesc": "When true, Mattermost allows compliance reporting", + "admin.compliance.directoryTitle": "Compliance Directory Location:", + "admin.compliance.directoryDescription": "Directory to which compliance reports are written. If blank, will be set to ./data/.", + "admin.compliance.enableDailyTitle": "Enable Daily Report:", + "admin.compliance.enableDesc": "When true, Mattermost will generate a daily compliance report.", + "admin.compliance.save": "Save", + "admin.compliance_reports.from": "From:", + "admin.compliance_reports.to": "To:", + "admin.compliance_reports.emails": "Emails:", + "admin.compliance_reports.keywords": "Keywords:", + "admin.compliance_table.download": "Download", + "admin.compliance_table.timestamp": "Timestamp", + "admin.compliance_table.status": "Status", + "admin.compliance_table.records": "Records", + "admin.compliance_table.type": "Type", + "admin.compliance_table.desc": "Description", + "admin.compliance_table.userId": "Requested By", + "admin.compliance_table.params": "Params", + "admin.compliance_reports.title": "Compliance Reports", + "admin.compliance_reports.desc": "Job Name:", + "admin.compliance_reports.desc_placeholder": "Ex \"Audit 445 for HR\"", + "admin.compliance_reports.from_placeholder": "Ex \"2016-03-11\"", + "admin.compliance_reports.to_placeholder": "Ex \"2016-03-15\"", + "admin.compliance_reports.emails_placeholder": "Ex \"bill@example.com, bob@example.com\"", + "admin.compliance_reports.keywords_placeholder": "Ex \"shorting stock\"", + "admin.compliance_reports.run": "Run", + "admin.compliance_reports.reload": "Reload", "admin.licence.keyMigration": "If you’re migrating servers you may need to remove your license key from this server in order to install it on a new server. To start, <a href=\"http://mattermost.com\" target=\"_blank\">disable all Enterprise Edition features on this server</a>. This will enable the ability to remove the license key and downgrade this server from Enterprise Edition to Team Edition.", "admin.license.chooseFile": "Choose File", "admin.license.edition": "Edition: ", @@ -331,6 +365,7 @@ "admin.sidebar.gitlab": "GitLab Settings", "admin.sidebar.ldap": "LDAP Settings", "admin.sidebar.license": "Edition and License", + "admin.sidebar.compliance": "Compliance Settings", "admin.sidebar.loading": "Loading", "admin.sidebar.log": "Log Settings", "admin.sidebar.logs": "Logs", diff --git a/webapp/sass/routes/_admin-console.scss b/webapp/sass/routes/_admin-console.scss index f83ce487e..aff1e8e8e 100644 --- a/webapp/sass/routes/_admin-console.scss +++ b/webapp/sass/routes/_admin-console.scss @@ -175,6 +175,26 @@ background-color: white; } + .compliance__panel { + overflow: scroll; + width: 100%; + height: 400px; + border: 1px solid #ddd; + margin-top: 10px; + padding: 5px; + background-color: white; + } + + .audit__panel { + overflow: scroll; + width: 100%; + height: 400px; + border: 1px solid #ddd; + margin-top: 10px; + padding: 5px; + background-color: white; + } + .app__content { color: #333; diff --git a/webapp/stores/admin_store.jsx b/webapp/stores/admin_store.jsx index 0a4c8c442..0f19dd484 100644 --- a/webapp/stores/admin_store.jsx +++ b/webapp/stores/admin_store.jsx @@ -13,6 +13,7 @@ const LOG_CHANGE_EVENT = 'log_change'; const SERVER_AUDIT_CHANGE_EVENT = 'server_audit_change'; const CONFIG_CHANGE_EVENT = 'config_change'; const ALL_TEAMS_EVENT = 'all_team_change'; +const SERVER_COMPLIANCE_REPORT_CHANGE_EVENT = 'server_compliance_reports_change'; class AdminStoreClass extends EventEmitter { constructor() { @@ -22,6 +23,7 @@ class AdminStoreClass extends EventEmitter { this.audits = null; this.config = null; this.teams = null; + this.complianceReports = null; this.emitLogChange = this.emitLogChange.bind(this); this.addLogChangeListener = this.addLogChangeListener.bind(this); @@ -31,6 +33,10 @@ class AdminStoreClass extends EventEmitter { this.addAuditChangeListener = this.addAuditChangeListener.bind(this); this.removeAuditChangeListener = this.removeAuditChangeListener.bind(this); + this.emitComplianceReportsChange = this.emitComplianceReportsChange.bind(this); + this.addComplianceReportsChangeListener = this.addComplianceReportsChangeListener.bind(this); + this.removeComplianceReportsChangeListener = this.removeComplianceReportsChangeListener.bind(this); + this.emitConfigChange = this.emitConfigChange.bind(this); this.addConfigChangeListener = this.addConfigChangeListener.bind(this); this.removeConfigChangeListener = this.removeConfigChangeListener.bind(this); @@ -64,6 +70,18 @@ class AdminStoreClass extends EventEmitter { this.removeListener(SERVER_AUDIT_CHANGE_EVENT, callback); } + emitComplianceReportsChange() { + this.emit(SERVER_COMPLIANCE_REPORT_CHANGE_EVENT); + } + + addComplianceReportsChangeListener(callback) { + this.on(SERVER_COMPLIANCE_REPORT_CHANGE_EVENT, callback); + } + + removeComplianceReportsChangeListener(callback) { + this.removeListener(SERVER_COMPLIANCE_REPORT_CHANGE_EVENT, callback); + } + emitConfigChange() { this.emit(CONFIG_CHANGE_EVENT); } @@ -104,6 +122,14 @@ class AdminStoreClass extends EventEmitter { this.audits = audits; } + getComplianceReports() { + return this.complianceReports; + } + + saveComplianceReports(complianceReports) { + this.complianceReports = complianceReports; + } + getConfig() { return this.config; } @@ -147,6 +173,10 @@ AdminStoreClass.dispatchToken = AppDispatcher.register((payload) => { AdminStore.saveAudits(action.audits); AdminStore.emitAuditChange(); break; + case ActionTypes.RECEIVED_SERVER_COMPLIANCE_REPORTS: + AdminStore.saveComplianceReports(action.complianceReports); + AdminStore.emitComplianceReportsChange(); + break; case ActionTypes.RECEIVED_CONFIG: AdminStore.saveConfig(action.config); AdminStore.emitConfigChange(); diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 9c40311cf..d3f91bb0e 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -342,6 +342,32 @@ export function getServerAudits() { ); } +export function getComplianceReports() { + if (isCallInProgress('getComplianceReports')) { + return; + } + + callTracker.getComplianceReports = utils.getTimestamp(); + client.getComplianceReports( + (data, textStatus, xhr) => { + callTracker.getComplianceReports = 0; + + if (xhr.status === 304 || !data) { + return; + } + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_SERVER_COMPLIANCE_REPORTS, + complianceReports: data + }); + }, + (err) => { + callTracker.getComplianceReports = 0; + dispatchError(err, 'getComplianceReports'); + } + ); +} + export function getConfig() { if (isCallInProgress('getConfig')) { return; diff --git a/webapp/utils/client.jsx b/webapp/utils/client.jsx index 9bd62e22d..e29cf71d3 100644 --- a/webapp/utils/client.jsx +++ b/webapp/utils/client.jsx @@ -413,6 +413,35 @@ export function getAudits(userId, success, error) { }); } +export function getComplianceReports(success, error) { + $.ajax({ + url: '/api/v1/admin/compliance_reports', + dataType: 'json', + contentType: 'application/json', + type: 'GET', + success, + error: function onError(xhr, status, err) { + var e = handleError('getComplianceReports', xhr, status, err); + error(e); + } + }); +} + +export function saveComplianceReports(job, success, error) { + $.ajax({ + url: '/api/v1/admin/save_compliance_report', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(job), + success, + error: (xhr, status, err) => { + var e = handleError('saveComplianceReports', xhr, status, err); + error(e); + } + }); +} + export function getLogs(success, error) { $.ajax({ url: '/api/v1/admin/logs', diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index 32123e369..0f7c9857d 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -76,6 +76,7 @@ export default { RECEIVED_CONFIG: null, RECEIVED_LOGS: null, RECEIVED_SERVER_AUDITS: null, + RECEIVED_SERVER_COMPLIANCE_REPORTS: null, RECEIVED_ALL_TEAMS: null, RECEIVED_LOCALE: null, |