Skip to content

Commit

Permalink
Use es.js api instead of transport.request
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Dec 18, 2019
1 parent 4449ca2 commit ae0e48f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ const mockReq = (searchResult = {}, securityEnabled = true, userHasPermissions =
) {
return Promise.resolve({ cluster_uuid: liveClusterUuid });
}
if (
type === 'transport.request' &&
params &&
params.path === '/_security/user/_has_privileges'
) {
if (type === 'security.hasPrivileges') {
return Promise.resolve({ has_all_requested: userHasPermissions });
}
if (type === 'transport.request' && params && params.path === '/_nodes') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,7 @@ async function hasNecessaryPermissions(req) {
}

const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('data');
const response = await callWithRequest(req, 'transport.request', {
method: 'POST',
path: '/_security/user/_has_privileges',
const response = await callWithRequest(req, 'security.hasPrivileges', {
body: {
cluster: ['monitor'],
},
Expand Down

0 comments on commit ae0e48f

Please sign in to comment.