Skip to content

Commit

Permalink
[ML] Adding filters privileges (#21021)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic authored Jul 21, 2018
1 parent ab0e2ba commit cdafa2f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions x-pack/plugins/ml/public/privilege/get_privileges.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
]
};

Expand Down Expand Up @@ -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']) {
Expand All @@ -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);
Expand Down

0 comments on commit cdafa2f

Please sign in to comment.