Skip to content

Commit 4b8b831

Browse files
author
Christoph Büscher
authored
Remove unused reference to filePermissionsCache (#31923)
Currently Role.Builder keeps a reference to the FieldPermissionsCache that is passed into its constructors. This seems to be unused except for passing it on to convertFromIndicesPrivileges() in the second ctor itself, but we don't need to keep the internal reference in that case, so it can be removed. Relates to #31876
1 parent c6666fc commit 4b8b831

File tree

2 files changed

+3
-10
lines changed
  • x-pack/plugin
    • core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission
    • security/src/main/java/org/elasticsearch/xpack/security/authz/store

2 files changed

+3
-10
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/Role.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ public RunAsPermission runAs() {
5555
}
5656

5757
public static Builder builder(String... names) {
58-
return new Builder(names, null);
59-
}
60-
61-
public static Builder builder(String[] names, FieldPermissionsCache fieldPermissionsCache) {
62-
return new Builder(names, fieldPermissionsCache);
58+
return new Builder(names);
6359
}
6460

6561
public static Builder builder(RoleDescriptor rd, FieldPermissionsCache fieldPermissionsCache) {
@@ -94,16 +90,13 @@ public static class Builder {
9490
private ClusterPermission cluster = ClusterPermission.NONE;
9591
private RunAsPermission runAs = RunAsPermission.NONE;
9692
private List<IndicesPermission.Group> groups = new ArrayList<>();
97-
private FieldPermissionsCache fieldPermissionsCache = null;
9893

99-
private Builder(String[] names, FieldPermissionsCache fieldPermissionsCache) {
94+
private Builder(String[] names) {
10095
this.names = names;
101-
this.fieldPermissionsCache = fieldPermissionsCache;
10296
}
10397

10498
private Builder(RoleDescriptor rd, @Nullable FieldPermissionsCache fieldPermissionsCache) {
10599
this.names = new String[] { rd.getName() };
106-
this.fieldPermissionsCache = fieldPermissionsCache;
107100
if (rd.getClusterPrivileges().length == 0) {
108101
cluster = ClusterPermission.NONE;
109102
} else {

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public static Role buildRoleFromDescriptors(Set<RoleDescriptor> roleDescriptors,
278278

279279
final Set<String> clusterPrivs = clusterPrivileges.isEmpty() ? null : clusterPrivileges;
280280
final Privilege runAsPrivilege = runAs.isEmpty() ? Privilege.NONE : new Privilege(runAs, runAs.toArray(Strings.EMPTY_ARRAY));
281-
Role.Builder builder = Role.builder(roleNames.toArray(new String[roleNames.size()]), fieldPermissionsCache)
281+
Role.Builder builder = Role.builder(roleNames.toArray(new String[roleNames.size()]))
282282
.cluster(ClusterPrivilege.get(clusterPrivs))
283283
.runAs(runAsPrivilege);
284284
indicesPrivilegesMap.entrySet().forEach((entry) -> {

0 commit comments

Comments
 (0)