Skip to content

Commit

Permalink
Remove sourcemap:write field from api keys creation (elastic#139383)
Browse files Browse the repository at this point in the history
* Remove sourcemap:write field from api keys creation

* Fix types
  • Loading branch information
MiriamAparicio authored and Mpdreamz committed Sep 6, 2022
1 parent 7155bcf commit dbd9d8c
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 38 deletions.
2 changes: 0 additions & 2 deletions x-pack/plugins/apm/common/privilege_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import * as t from 'io-ts';

export const enum PrivilegeType {
SOURCEMAP = 'sourcemap:write',
EVENT = 'event:write',
AGENT_CONFIG = 'config_agent:read',
}

export const privilegesTypeRt = t.array(
t.union([
t.literal(PrivilegeType.SOURCEMAP),
t.literal(PrivilegeType.EVENT),
t.literal(PrivilegeType.AGENT_CONFIG),
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ export function CreateAgentKeyFlyout({ onCancel, onSuccess, onError }: Props) {

const [agentKeyBody, setAgentKeyBody] = useState({
name: '',
sourcemap: true,
event: true,
agentConfig: true,
});

const { name, sourcemap, event, agentConfig } = agentKeyBody;
const { name, event, agentConfig } = agentKeyBody;

const currentUser = useCurrentUser();

Expand All @@ -73,10 +72,6 @@ export function CreateAgentKeyFlyout({ onCancel, onSuccess, onError }: Props) {

try {
const privileges: PrivilegeType[] = [];
if (sourcemap) {
privileges.push(PrivilegeType.SOURCEMAP);
}

if (event) {
privileges.push(PrivilegeType.EVENT);
}
Expand Down Expand Up @@ -206,27 +201,6 @@ export function CreateAgentKeyFlyout({ onCancel, onSuccess, onError }: Props) {
/>
</EuiFormRow>
<EuiSpacer size="s" />
<EuiFormRow
helpText={i18n.translate(
'xpack.apm.settings.agentKeys.createKeyFlyout.sourcemaps',
{
defaultMessage: 'Required for uploading sourcemaps.',
}
)}
>
<EuiCheckbox
id={htmlIdGenerator()()}
label="sourcemap:write"
checked={sourcemap}
onChange={() =>
setAgentKeyBody((state) => ({
...state,
sourcemap: !state.sourcemap,
}))
}
/>
</EuiFormRow>
<EuiSpacer size="s" />
</EuiFormFieldset>
</EuiForm>
</EuiFlyoutBody>
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -7374,7 +7374,6 @@
"xpack.apm.settings.agentKeys.createKeyFlyout.namePlaceholder": "Par exemple, apm-key",
"xpack.apm.settings.agentKeys.createKeyFlyout.nameTitle": "Nom",
"xpack.apm.settings.agentKeys.createKeyFlyout.privilegesFieldset": "Attribuer des privilèges",
"xpack.apm.settings.agentKeys.createKeyFlyout.sourcemaps": "Requis pour le téléchargement des cartes sources.",
"xpack.apm.settings.agentKeys.createKeyFlyout.userTitle": "Utilisateur",
"xpack.apm.settings.agentKeys.deleteConfirmModal.cancel": "Annuler",
"xpack.apm.settings.agentKeys.deleteConfirmModal.delete": "Supprimer",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -7363,7 +7363,6 @@
"xpack.apm.settings.agentKeys.createKeyFlyout.namePlaceholder": "例:apm-key",
"xpack.apm.settings.agentKeys.createKeyFlyout.nameTitle": "名前",
"xpack.apm.settings.agentKeys.createKeyFlyout.privilegesFieldset": "権限を割り当て",
"xpack.apm.settings.agentKeys.createKeyFlyout.sourcemaps": "ソースマップのアップロードに必要です。",
"xpack.apm.settings.agentKeys.createKeyFlyout.userTitle": "ユーザー",
"xpack.apm.settings.agentKeys.deleteConfirmModal.cancel": "キャンセル",
"xpack.apm.settings.agentKeys.deleteConfirmModal.delete": "削除",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -7377,7 +7377,6 @@
"xpack.apm.settings.agentKeys.createKeyFlyout.namePlaceholder": "例如,apm-key",
"xpack.apm.settings.agentKeys.createKeyFlyout.nameTitle": "名称",
"xpack.apm.settings.agentKeys.createKeyFlyout.privilegesFieldset": "分配权限",
"xpack.apm.settings.agentKeys.createKeyFlyout.sourcemaps": "上传源地图所必需。",
"xpack.apm.settings.agentKeys.createKeyFlyout.userTitle": "用户",
"xpack.apm.settings.agentKeys.deleteConfirmModal.cancel": "取消",
"xpack.apm.settings.agentKeys.deleteConfirmModal.delete": "删除",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/apm_api_integration/common/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const customRoles = {
applications: [
{
application: 'apm',
privileges: [PrivilegeType.AGENT_CONFIG, PrivilegeType.EVENT, PrivilegeType.SOURCEMAP],
privileges: [PrivilegeType.AGENT_CONFIG, PrivilegeType.EVENT],
resources: ['*'],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
const esClient = getService('es');

const agentKeyName = 'test';
const allApplicationPrivileges = [
PrivilegeType.AGENT_CONFIG,
PrivilegeType.EVENT,
PrivilegeType.SOURCEMAP,
];
const allApplicationPrivileges = [PrivilegeType.AGENT_CONFIG, PrivilegeType.EVENT];

async function createAgentKey(apiClient: ApmApiSupertest, privileges = allApplicationPrivileges) {
return await apiClient({
Expand Down

0 comments on commit dbd9d8c

Please sign in to comment.