Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added workflow execution logic #850

Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ class TransportDeleteWorkflowAction @Inject constructor(

val deleteResponse = deleteWorkflow(workflow)
if (deleteDelegateMonitors == true) {
if (user == null) {
deleteMonitors(delegateMonitorIds, RefreshPolicy.IMMEDIATE)
} else {
if (user != null && filterByEnabled) {
// Un-stash the context
withClosableContext(
InjectorContextElement(
Expand All @@ -167,6 +165,8 @@ class TransportDeleteWorkflowAction @Inject constructor(
) {
deleteMonitors(delegateMonitorIds, RefreshPolicy.IMMEDIATE)
}
} else {
deleteMonitors(delegateMonitorIds, RefreshPolicy.IMMEDIATE)
}
}
actionListener.onResponse(DeleteWorkflowResponse(deleteResponse.id, deleteResponse.version))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ class TransportIndexWorkflowAction @Inject constructor(
val searchSource = SearchSourceBuilder().query(query)
val searchRequest = SearchRequest(SCHEDULED_JOBS_INDEX).source(searchSource)

if (user != null && !isAdmin(user) && filterByEnabled) {
if (user != null && filterByEnabled) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing the !isAdmin(user) piece? Admin users bypass the filter by check.

addFilter(user, searchRequest.source(), "monitor.user.backend_roles.keyword")
}

Expand Down Expand Up @@ -647,9 +647,7 @@ class TransportIndexWorkflowAction @Inject constructor(
val indicesSearchRequest = SearchRequest().indices(*indices.toTypedArray())
.source(SearchSourceBuilder.searchSource().size(1).query(QueryBuilders.matchAllQuery()))

if (user == null) {
checkIndicesAccess(client, indicesSearchRequest, indices, actionListener)
} else {
if (user != null && filterByEnabled) {
// Unstash the context and check if user with specified roles has indices access
withClosableContext(
InjectorContextElement(
Expand All @@ -662,6 +660,8 @@ class TransportIndexWorkflowAction @Inject constructor(
) {
checkIndicesAccess(client, indicesSearchRequest, indices, actionListener)
}
} else {
checkIndicesAccess(client, indicesSearchRequest, indices, actionListener)
}
}

Expand Down