From cdafa2f0927e3bcc447a6a9769047fcd16fa9e5c Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Sat, 21 Jul 2018 11:49:41 +0100 Subject: [PATCH] [ML] Adding filters privileges (#21021) --- .../ml/public/privilege/get_privileges.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/x-pack/plugins/ml/public/privilege/get_privileges.js b/x-pack/plugins/ml/public/privilege/get_privileges.js index 98ea39fa8003a..635b074c30a6b 100644 --- a/x-pack/plugins/ml/public/privilege/get_privileges.js +++ b/x-pack/plugins/ml/public/privilege/get_privileges.js @@ -31,6 +31,7 @@ export function getPrivileges() { 'cluster:monitor/xpack/ml/job/stats/get', 'cluster:monitor/xpack/ml/datafeeds/get', 'cluster:monitor/xpack/ml/datafeeds/stats/get', + 'cluster:monitor/xpack/ml/calendars/get', 'cluster:admin/xpack/ml/job/put', 'cluster:admin/xpack/ml/job/delete', 'cluster:admin/xpack/ml/job/update', @@ -48,6 +49,10 @@ export function getPrivileges() { 'cluster:admin/xpack/ml/calendars/jobs/update', 'cluster:admin/xpack/ml/calendars/events/post', 'cluster:admin/xpack/ml/calendars/events/delete', + 'cluster:admin/xpack/ml/filters/put', + 'cluster:admin/xpack/ml/filters/get', + 'cluster:admin/xpack/ml/filters/update', + 'cluster:admin/xpack/ml/filters/delete', ] }; @@ -110,6 +115,10 @@ export function getPrivileges() { privileges.canPreviewDatafeed = true; } + if (resp.cluster['cluster:monitor/xpack/ml/calendars/get']) { + privileges.canGetCalendars = true; + } + if (resp.cluster['cluster:admin/xpack/ml/calendars/put'] && resp.cluster['cluster:admin/xpack/ml/calendars/jobs/update'] && resp.cluster['cluster:admin/xpack/ml/calendars/events/post']) { @@ -120,6 +129,20 @@ export function getPrivileges() { resp.cluster['cluster:admin/xpack/ml/calendars/events/delete']) { privileges.canDeleteCalendar = true; } + + if (resp.cluster['cluster:admin/xpack/ml/filters/get']) { + privileges.canGetFilters = true; + } + + if (resp.cluster['cluster:admin/xpack/ml/filters/put'] && + resp.cluster['cluster:admin/xpack/ml/filters/update']) { + privileges.canCreateFilter = true; + } + + if (resp.cluster['cluster:admin/xpack/ml/filters/delete']) { + privileges.canDeleteFilter = true; + } + } resolve(privileges);