add INDEX_LIFECYCLE_ORIGIN to run as xpack

This commit is contained in:
Tal Levy 2018-08-20 15:44:47 -07:00
parent 5ce082cd0a
commit 2b3cb240f2
2 changed files with 3 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import java.util.function.Consumer;
import java.util.function.Predicate;
import static org.elasticsearch.xpack.core.ClientHelper.DEPRECATION_ORIGIN;
import static org.elasticsearch.xpack.core.ClientHelper.INDEX_LIFECYCLE_ORIGIN;
import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN;
import static org.elasticsearch.xpack.core.ClientHelper.MONITORING_ORIGIN;
import static org.elasticsearch.xpack.core.ClientHelper.PERSISTENT_TASK_ORIGIN;
@ -111,6 +112,7 @@ public final class AuthorizationUtils {
case DEPRECATION_ORIGIN:
case PERSISTENT_TASK_ORIGIN:
case ROLLUP_ORIGIN:
case INDEX_LIFECYCLE_ORIGIN:
securityContext.executeAsUser(XPackUser.INSTANCE, consumer, Version.CURRENT);
break;
default:

View File

@ -140,7 +140,7 @@ public class AuthorizationUtilsTests extends ESTestCase {
threadContext.putHeader(headerName, headerValue);
threadContext.putTransient(ClientHelper.ACTION_ORIGIN_TRANSIENT_NAME,
randomFrom(ClientHelper.ML_ORIGIN, ClientHelper.WATCHER_ORIGIN, ClientHelper.DEPRECATION_ORIGIN,
ClientHelper.MONITORING_ORIGIN, ClientHelper.PERSISTENT_TASK_ORIGIN));
ClientHelper.MONITORING_ORIGIN, ClientHelper.PERSISTENT_TASK_ORIGIN, ClientHelper.INDEX_LIFECYCLE_ORIGIN));
AuthorizationUtils.switchUserBasedOnActionOriginAndExecute(threadContext, securityContext, consumer);