Skip to content

Commit aedd620

Browse files
committed
Cleanup authorization for updateApiKey
1 parent 4b3c3ed commit aedd620

3 files changed

Lines changed: 2 additions & 11 deletions

File tree

x-pack/plugins/alerts/server/alerts_client/alerts_client.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,10 +818,7 @@ export class AlertsClient {
818818
attributes.consumer,
819819
WriteOperations.UpdateApiKey
820820
);
821-
if (
822-
attributes.actions.length &&
823-
!this.authorization.shouldUseLegacyAuthorization(attributes)
824-
) {
821+
if (attributes.actions.length) {
825822
await this.actionsAuthorization.ensureAuthorized('execute');
826823
}
827824
} catch (error) {

x-pack/plugins/alerts/server/authorization/alerts_authorization.mock.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const createAlertsAuthorizationMock = () => {
1414
ensureAuthorized: jest.fn(),
1515
filterByAlertTypeAuthorization: jest.fn(),
1616
getFindAuthorizationFilter: jest.fn(),
17-
shouldUseLegacyAuthorization: jest.fn(),
1817
};
1918
return mocked;
2019
};

x-pack/plugins/alerts/server/authorization/alerts_authorization.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ import Boom from '@hapi/boom';
88
import { map, mapValues, fromPairs, has } from 'lodash';
99
import { KibanaRequest } from 'src/core/server';
1010
import { ALERTS_FEATURE_ID } from '../../common';
11-
import { AlertTypeRegistry, RawAlert } from '../types';
11+
import { AlertTypeRegistry } from '../types';
1212
import { SecurityPluginSetup } from '../../../security/server';
1313
import { RegistryAlertType } from '../alert_type_registry';
1414
import { PluginStartContract as FeaturesPluginStart } from '../../../features/server';
1515
import { AlertsAuthorizationAuditLogger, ScopeType } from './audit_logger';
1616
import { Space } from '../../../spaces/server';
17-
import { LEGACY_LAST_MODIFIED_VERSION } from '../saved_objects/migrations';
1817
import { asFiltersByAlertTypeAndConsumer } from './alerts_authorization_kuery';
1918
import { KueryNode } from '../../../../../src/plugins/data/server';
2019

@@ -112,10 +111,6 @@ export class AlertsAuthorization {
112111
);
113112
}
114113

115-
public shouldUseLegacyAuthorization(alert: RawAlert): boolean {
116-
return alert.meta?.versionApiKeyLastmodified === LEGACY_LAST_MODIFIED_VERSION;
117-
}
118-
119114
private shouldCheckAuthorization(): boolean {
120115
return this.authorization?.mode?.useRbacForRequest(this.request) ?? false;
121116
}

0 commit comments

Comments
 (0)