-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
782 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...test/saved_object_api_integration/common/fixtures/namespace_agnostic_type_plugin/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import mappings from './mappings.json'; | ||
|
||
export default function (kibana) { | ||
return new kibana.Plugin({ | ||
require: [], | ||
name: 'namespace_agnostic_type_plugin', | ||
uiExports: { | ||
savedObjectsSchema: { | ||
chapo: { | ||
isNamespaceAgnostic: true | ||
} | ||
}, | ||
mappings, | ||
}, | ||
|
||
config() {}, | ||
}); | ||
} |
15 changes: 15 additions & 0 deletions
15
...saved_object_api_integration/common/fixtures/namespace_agnostic_type_plugin/mappings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"chapo": { | ||
"properties": { | ||
"name": { | ||
"type": "text", | ||
"fields": { | ||
"keyword": { | ||
"type": "keyword", | ||
"ignore_above": 2048 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
.../saved_object_api_integration/common/fixtures/namespace_agnostic_type_plugin/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "namespace_agnostic_type_plugin", | ||
"version": "0.0.0", | ||
"kibana": { | ||
"version": "kibana" | ||
} | ||
} |
176 changes: 176 additions & 0 deletions
176
x-pack/test/saved_object_api_integration/common/lib/create_users_and_roles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { AUTHENTICATION } from './authentication'; | ||
|
||
export const createUsersAndRoles = async (es, supertest) => { | ||
await supertest.put('/api/security/role/kibana_legacy_user') | ||
.send({ | ||
elasticsearch: { | ||
indices: [{ | ||
names: ['.kibana'], | ||
privileges: ['manage', 'read', 'index', 'delete'] | ||
}] | ||
} | ||
}); | ||
|
||
await supertest.put('/api/security/role/kibana_legacy_dashboard_only_user') | ||
.send({ | ||
elasticsearch: { | ||
indices: [{ | ||
names: ['.kibana'], | ||
privileges: ['read', 'view_index_metadata'] | ||
}] | ||
} | ||
}); | ||
|
||
await supertest.put('/api/security/role/kibana_dual_privileges_user') | ||
.send({ | ||
elasticsearch: { | ||
indices: [{ | ||
names: ['.kibana'], | ||
privileges: ['manage', 'read', 'index', 'delete'] | ||
}] | ||
}, | ||
kibana: { | ||
global: ['all'] | ||
} | ||
}); | ||
|
||
await supertest.put('/api/security/role/kibana_dual_privileges_dashboard_only_user') | ||
.send({ | ||
elasticsearch: { | ||
indices: [{ | ||
names: ['.kibana'], | ||
privileges: ['read', 'view_index_metadata'] | ||
}] | ||
}, | ||
kibana: { | ||
global: ['read'] | ||
} | ||
}); | ||
|
||
await supertest.put('/api/security/role/kibana_rbac_user') | ||
.send({ | ||
kibana: { | ||
global: ['all'] | ||
} | ||
}); | ||
|
||
await supertest.put('/api/security/role/kibana_rbac_dashboard_only_user') | ||
.send({ | ||
kibana: { | ||
global: ['read'] | ||
} | ||
}); | ||
|
||
await supertest.put('/api/security/role/kibana_rbac_default_space_user') | ||
.send({ | ||
kibana: { | ||
space: { | ||
default: ['all'] | ||
} | ||
} | ||
}); | ||
|
||
await supertest.put('/api/security/role/kibana_rbac_space_1_read_user') | ||
.send({ | ||
kibana: { | ||
space: { | ||
space_1: ['read'] | ||
} | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.NOT_A_KIBANA_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.NOT_A_KIBANA_USER.PASSWORD, | ||
roles: [], | ||
full_name: 'not a kibana user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.KIBANA_LEGACY_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.KIBANA_LEGACY_USER.PASSWORD, | ||
roles: ['kibana_legacy_user'], | ||
full_name: 'a kibana legacy user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.KIBANA_LEGACY_DASHBOARD_ONLY_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.KIBANA_LEGACY_DASHBOARD_ONLY_USER.PASSWORD, | ||
roles: ["kibana_legacy_dashboard_only_user"], | ||
full_name: 'a kibana legacy dashboard only user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.KIBANA_DUAL_PRIVILEGES_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.KIBANA_DUAL_PRIVILEGES_USER.PASSWORD, | ||
roles: ['kibana_dual_privileges_user'], | ||
full_name: 'a kibana dual_privileges user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.KIBANA_DUAL_PRIVILEGES_DASHBOARD_ONLY_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.KIBANA_DUAL_PRIVILEGES_DASHBOARD_ONLY_USER.PASSWORD, | ||
roles: ["kibana_dual_privileges_dashboard_only_user"], | ||
full_name: 'a kibana dual_privileges dashboard only user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.KIBANA_RBAC_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.KIBANA_RBAC_USER.PASSWORD, | ||
roles: ['kibana_rbac_user'], | ||
full_name: 'a kibana user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.KIBANA_RBAC_DASHBOARD_ONLY_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.KIBANA_RBAC_DASHBOARD_ONLY_USER.PASSWORD, | ||
roles: ["kibana_rbac_dashboard_only_user"], | ||
full_name: 'a kibana dashboard only user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_USER.PASSWORD, | ||
roles: ['kibana_rbac_default_space_user'], | ||
full_name: 'a kibana default space user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
|
||
await es.shield.putUser({ | ||
username: AUTHENTICATION.KIBANA_RBAC_SPACE_1_READONLY_USER.USERNAME, | ||
body: { | ||
password: AUTHENTICATION.KIBANA_RBAC_SPACE_1_READONLY_USER.PASSWORD, | ||
roles: ['kibana_rbac_space_1_read_user'], | ||
full_name: 'a kibana rbac space 1 read-only user', | ||
email: '[email protected]', | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
x-pack/test/saved_object_api_integration/security_and_spaces/apis/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { createUsersAndRoles } from "../../common/lib/create_users_and_roles"; | ||
|
||
export default function ({ loadTestFile, getService }) { | ||
const es = getService('es'); | ||
const supertest = getService('supertest'); | ||
|
||
describe('security and spaces enabled', () => { | ||
before(async () => { | ||
await createUsersAndRoles(es, supertest); | ||
}); | ||
|
||
loadTestFile(require.resolve('./saved_objects')); | ||
}); | ||
} |
Oops, something went wrong.