|  | 
| 27 | 27 | import java.util.Map.Entry; | 
| 28 | 28 | import java.util.Objects; | 
| 29 | 29 | import java.util.Set; | 
|  | 30 | +import java.util.TreeSet; | 
| 30 | 31 | import java.util.concurrent.Callable; | 
| 31 | 32 | import java.util.concurrent.ExecutionException; | 
| 32 | 33 | import java.util.concurrent.ExecutorService; | 
| @@ -1116,21 +1117,21 @@ public Map<String, Boolean> mapTenants(final User user, Set<String> roles) { | 
| 1116 | 1117 | 
 | 
| 1117 | 1118 |                 if (rw || !result.containsKey(tenant)) { //RW outperforms RO | 
| 1118 | 1119 | 
 | 
| 1119 |  | -                    // We want to make sure that we add a tenant that exissts | 
|  | 1120 | +                    // We want to make sure that we add a tenant that exists | 
| 1120 | 1121 |                     // Indeed, because we don't have control over what will be | 
| 1121 | 1122 |                     // passed on as values of users' attributes, we have to make | 
| 1122 | 1123 |                     // sure that we don't allow them to select tenants that do not exist. | 
| 1123 |  | -                    if(ConfigModelV7.this.tenants.getCEntries().keySet().contains(tenant)) { | 
|  | 1124 | +                    if(ConfigModelV7.this.tenants.getCEntries().containsKey(tenant)) { | 
| 1124 | 1125 |                         result.put(tenant, rw); | 
| 1125 | 1126 |                     } | 
| 1126 | 1127 |                 } | 
| 1127 | 1128 |             }); | 
| 1128 |  | -             | 
|  | 1129 | + | 
|  | 1130 | +            Set<String> _roles = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); | 
|  | 1131 | +            _roles.addAll(roles); | 
| 1129 | 1132 |             if(!result.containsKey("global_tenant") && ( | 
| 1130 |  | -                    roles.contains("kibana_user") | 
| 1131 |  | -                    || roles.contains("kibana_user") | 
| 1132 |  | -                    || roles.contains("all_access") | 
| 1133 |  | -                    || roles.contains("ALL_ACCESS") | 
|  | 1133 | +                    _roles.contains("kibana_user") | 
|  | 1134 | +                    || _roles.contains("all_access") | 
| 1134 | 1135 |                     )) { | 
| 1135 | 1136 |                 result.put("global_tenant", true); | 
| 1136 | 1137 |             } | 
|  | 
0 commit comments