Skip to content

Commit

Permalink
Add suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
thomheymann committed Dec 10, 2020
1 parent 2a98ba9 commit eb8645f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions x-pack/plugins/security/server/audit/audit_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class AuditService {
/**
* @deprecated
*/
private allowAuditLogging = false;
private allowLegacyAuditLogging = false;

private ecsLogger: Logger;

Expand All @@ -89,7 +89,7 @@ export class AuditService {
if (config.enabled && !config.appender) {
this.licenseFeaturesSubscription = license.features$.subscribe(
({ allowLegacyAuditLogging }) => {
this.allowAuditLogging = allowLegacyAuditLogging;
this.allowLegacyAuditLogging = allowLegacyAuditLogging;
}
);
}
Expand Down Expand Up @@ -171,7 +171,7 @@ export class AuditService {
const getLogger = (id?: string): LegacyAuditLogger => {
return {
log: (eventType: string, message: string, data?: Record<string, any>) => {
if (!this.allowAuditLogging) {
if (!this.allowLegacyAuditLogging) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ export function registerSecurityUsageCollector({ usageCollection, config, licens
};
}

const legacyAuditLoggingEnabled = allowLegacyAuditLogging && config.audit.enabled;
const auditLoggingEnabled =
(allowAuditLogging || allowLegacyAuditLogging) && config.audit.enabled;
allowAuditLogging && config.audit.enabled && config.audit.appender != null;

const loginSelectorEnabled = config.authc.selector.enabled;
const authProviderCount = config.authc.sortedProviders.length;
const enabledAuthProviders = [
Expand All @@ -113,7 +115,7 @@ export function registerSecurityUsageCollector({ usageCollection, config, licens
);

return {
auditLoggingEnabled,
auditLoggingEnabled: legacyAuditLoggingEnabled || auditLoggingEnabled,
loginSelectorEnabled,
accessAgreementEnabled,
authProviderCount,
Expand Down

0 comments on commit eb8645f

Please sign in to comment.