diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/Role.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/Role.java index 8fed501ece2c9..a850a4a16f65b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/Role.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/Role.java @@ -55,11 +55,7 @@ public RunAsPermission runAs() { } public static Builder builder(String... names) { - return new Builder(names, null); - } - - public static Builder builder(String[] names, FieldPermissionsCache fieldPermissionsCache) { - return new Builder(names, fieldPermissionsCache); + return new Builder(names); } public static Builder builder(RoleDescriptor rd, FieldPermissionsCache fieldPermissionsCache) { @@ -94,16 +90,13 @@ public static class Builder { private ClusterPermission cluster = ClusterPermission.NONE; private RunAsPermission runAs = RunAsPermission.NONE; private List groups = new ArrayList<>(); - private FieldPermissionsCache fieldPermissionsCache = null; - private Builder(String[] names, FieldPermissionsCache fieldPermissionsCache) { + private Builder(String[] names) { this.names = names; - this.fieldPermissionsCache = fieldPermissionsCache; } private Builder(RoleDescriptor rd, @Nullable FieldPermissionsCache fieldPermissionsCache) { this.names = new String[] { rd.getName() }; - this.fieldPermissionsCache = fieldPermissionsCache; if (rd.getClusterPrivileges().length == 0) { cluster = ClusterPermission.NONE; } else { diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java index b5a20af8d30b9..1018ceeda093c 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java @@ -278,7 +278,7 @@ public static Role buildRoleFromDescriptors(Set roleDescriptors, final Set clusterPrivs = clusterPrivileges.isEmpty() ? null : clusterPrivileges; final Privilege runAsPrivilege = runAs.isEmpty() ? Privilege.NONE : new Privilege(runAs, runAs.toArray(Strings.EMPTY_ARRAY)); - Role.Builder builder = Role.builder(roleNames.toArray(new String[roleNames.size()]), fieldPermissionsCache) + Role.Builder builder = Role.builder(roleNames.toArray(new String[roleNames.size()])) .cluster(ClusterPrivilege.get(clusterPrivs)) .runAs(runAsPrivilege); indicesPrivilegesMap.entrySet().forEach((entry) -> {