Skip to content

Commit

Permalink
Reverting name change
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-buttner committed Apr 19, 2021
1 parent 81b6695 commit 80b435d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions x-pack/plugins/cases/server/authorization/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Authorization {
private readonly request: KibanaRequest;
private readonly securityAuth: SecurityPluginStart['authz'] | undefined;
private readonly featureCaseOwners: Set<string>;
private readonly authLogger: AuthorizationAuditLogger;
private readonly auditLogger: AuthorizationAuditLogger;

private constructor({
request,
Expand All @@ -37,7 +37,7 @@ export class Authorization {
this.request = request;
this.securityAuth = securityAuth;
this.featureCaseOwners = caseOwners;
this.authLogger = auditLogger;
this.auditLogger = auditLogger;
}

/**
Expand Down Expand Up @@ -99,16 +99,16 @@ export class Authorization {
* as Privileged.
* This check will ensure we don't accidentally let these through
*/
throw Boom.forbidden(this.authLogger.failure({ username, owner, operation }));
throw Boom.forbidden(this.auditLogger.failure({ username, owner, operation }));
}

if (hasAllRequested) {
this.authLogger.success({ username, operation, owner });
this.auditLogger.success({ username, operation, owner });
} else {
throw Boom.forbidden(this.authLogger.failure({ owner, operation, username }));
throw Boom.forbidden(this.auditLogger.failure({ owner, operation, username }));
}
} else if (!isOwnerAvailable) {
throw Boom.forbidden(this.authLogger.failure({ owner, operation }));
throw Boom.forbidden(this.auditLogger.failure({ owner, operation }));
}

// else security is disabled so let the operation proceed
Expand All @@ -122,19 +122,19 @@ export class Authorization {
const { username, authorizedOwners } = await this.getAuthorizedOwners([operation]);

if (!authorizedOwners.length) {
throw Boom.forbidden(this.authLogger.failure({ username, operation }));
throw Boom.forbidden(this.auditLogger.failure({ username, operation }));
}

return {
filter: getOwnersFilter(operation.savedObjectType, authorizedOwners),
ensureSavedObjectIsAuthorized: (owner: string) => {
if (!authorizedOwners.includes(owner)) {
throw Boom.forbidden(this.authLogger.failure({ username, operation, owner }));
throw Boom.forbidden(this.auditLogger.failure({ username, operation, owner }));
}
},
logSuccessfulAuthorization: () => {
if (authorizedOwners.length) {
this.authLogger.bulkSuccess({ username, owners: authorizedOwners, operation });
this.auditLogger.bulkSuccess({ username, owners: authorizedOwners, operation });
}
},
};
Expand Down

0 comments on commit 80b435d

Please sign in to comment.