Skip to content

Commit

Permalink
Dynamically supplying users so we reduce some duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
kobelb committed Sep 5, 2018
1 parent 9deec1b commit 1607f80
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 206 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@ export const AUTHENTICATION = {
USERNAME: 'a_kibana_rbac_dashboard_only_user',
PASSWORD: 'password'
},
KIBANA_RBAC_DEFAULT_SPACE_USER: {
USERNAME: 'a_kibana_rbac_default_space_user',
KIBANA_RBAC_DEFAULT_SPACE_ALL_USER: {
USERNAME: 'a_kibana_rbac_default_space_all_user',
PASSWORD: 'password'
},
KIBANA_RBAC_SPACE_1_READONLY_USER: {
USERNAME: 'a_kibana_rbac_space_1_readonly_user',
KIBANA_RBAC_DEFAULT_SPACE_READ_USER: {
USERNAME: 'a_kibana_rbac_default_space_read_user',
PASSWORD: 'password'
},
KIBANA_RBAC_SPACE_1_ALL_USER: {
USERNAME: 'a_kibana_rbac_space_1_all_user',
PASSWORD: 'password'
},
KIBANA_RBAC_SPACE_1_READ_USER: {
USERNAME: 'a_kibana_rbac_space_1_read_user',
PASSWORD: 'password'
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const createUsersAndRoles = async (es, supertest) => {
}
});

await supertest.put('/api/security/role/kibana_rbac_default_space_user')
await supertest.put('/api/security/role/kibana_rbac_default_space_all_user')
.send({
kibana: {
space: {
Expand All @@ -75,6 +75,24 @@ export const createUsersAndRoles = async (es, supertest) => {
}
});

await supertest.put('/api/security/role/kibana_rbac_default_space_read_user')
.send({
kibana: {
space: {
default: ['read']
}
}
});

await supertest.put('/api/security/role/kibana_rbac_space_1_all_user')
.send({
kibana: {
space: {
space_1: ['all']
}
}
});

await supertest.put('/api/security/role/kibana_rbac_space_1_read_user')
.send({
kibana: {
Expand Down Expand Up @@ -155,19 +173,39 @@ export const createUsersAndRoles = async (es, supertest) => {
});

await es.shield.putUser({
username: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_USER.USERNAME,
username: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_ALL_USER.USERNAME,
body: {
password: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_ALL_USER.PASSWORD,
roles: ['kibana_rbac_default_space_all_user'],
full_name: 'a kibana default space all user',
email: 'a_kibana_rbac_default_space_all_user@elastic.co',
}
});

await es.shield.putUser({
username: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_READ_USER.USERNAME,
body: {
password: AUTHENTICATION.KIBANA_RBAC_DEFAULT_SPACE_READ_USER.PASSWORD,
roles: ['kibana_rbac_default_space_read_user'],
full_name: 'a kibana default space read-only user',
email: 'a_kibana_rbac_default_space_read_user@elastic.co',
}
});

await es.shield.putUser({
username: AUTHENTICATION.KIBANA_RBAC_SPACE_1_ALL_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: 'a_kibana_rbac_default_space_user@elastic.co',
password: AUTHENTICATION.KIBANA_RBAC_SPACE_1_ALL_USER.PASSWORD,
roles: ['kibana_rbac_space_1_all_user'],
full_name: 'a kibana rbac space 1 all user',
email: 'a_kibana_rbac_space_1_all_user@elastic.co',
}
});

await es.shield.putUser({
username: AUTHENTICATION.KIBANA_RBAC_SPACE_1_READONLY_USER.USERNAME,
username: AUTHENTICATION.KIBANA_RBAC_SPACE_1_READ_USER.USERNAME,
body: {
password: AUTHENTICATION.KIBANA_RBAC_SPACE_1_READONLY_USER.PASSWORD,
password: AUTHENTICATION.KIBANA_RBAC_SPACE_1_READ_USER.PASSWORD,
roles: ['kibana_rbac_space_1_read_user'],
full_name: 'a kibana rbac space 1 read-only user',
email: 'a_kibana_rbac_space_1_readonly_user@elastic.co',
Expand Down
Loading

0 comments on commit 1607f80

Please sign in to comment.