File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 5050import java .util .Collections ;
5151import java .util .HashSet ;
5252import java .util .LinkedHashMap ;
53- import java .util .LinkedHashSet ;
5453import java .util .Locale ;
5554import java .util .Map ;
5655import java .util .Objects ;
@@ -435,13 +434,17 @@ private static Set<IndexPrivilege> combineIndexPrivileges(
435434 || false == actions .isEmpty () : "at least one of the privilege sets or actions must be non-empty" ;
436435
437436 if (false == allSelectorAccessPrivileges .isEmpty ()) {
438- assert failuresSelectorAccessPrivileges .isEmpty () && dataSelectorAccessPrivileges .isEmpty ()
439- : "data and failure access must be empty when all access is present" ;
437+ assert failuresSelectorAccessPrivileges .isEmpty ()
438+ && dataSelectorAccessPrivileges .isEmpty ()
439+ && dataAndFailuresSelectorAccessPrivileges .isEmpty () : "data and failure access must be empty when all access is present" ;
440440 return Set .of (union (allSelectorAccessPrivileges , actions , IndexComponentSelectorPredicate .ALL ));
441441 }
442442
443443 // linked hash set to preserve order across selectors
444- final Set <IndexPrivilege > combined = new LinkedHashSet <>();
444+ final Set <IndexPrivilege > combined = Sets .newLinkedHashSetWithExpectedSize (
445+ dataAndFailuresSelectorAccessPrivileges .size () + failuresSelectorAccessPrivileges .size () + dataSelectorAccessPrivileges .size ()
446+ + actions .size ()
447+ );
445448 if (false == dataSelectorAccessPrivileges .isEmpty () || false == actions .isEmpty ()) {
446449 combined .add (union (dataSelectorAccessPrivileges , actions , IndexComponentSelectorPredicate .DATA ));
447450 }
You can’t perform that action at this time.
0 commit comments