public Set<String> getAllConfiguredTenantNames() { final Settings roles = getRolesSettings(); if(roles == null || roles.isEmpty()) { return Collections.emptySet(); } final Set<String> configuredTenants = new HashSet<>(); for(String sgRole: roles.names()) { Settings tenants = roles.getByPrefix(sgRole+".tenants."); if(tenants != null) { configuredTenants.addAll(tenants.names()); } } return Collections.unmodifiableSet(configuredTenants); }
public Map<String, Boolean> mapTenants(final User user, final TransportAddress caller) { if(user == null) { return Collections.emptyMap(); } final Map<String, Boolean> result = new HashMap<>(); result.put(user.getName(), true); for(String sgRole: mapSgRoles(user, caller)) { Settings tenants = getRolesSettings().getByPrefix(sgRole+".tenants."); if(tenants != null) { for(String tenant: tenants.names()) { if(tenant.equals(user.getName())) { continue; } if("RW".equalsIgnoreCase(tenants.get(tenant, "RO"))) { result.put(tenant, true); } else { if(!result.containsKey(tenant)) { //RW outperforms RO result.put(tenant, false); } } } } } return Collections.unmodifiableMap(result); }
final Settings impersonationDns = settings.getByPrefix(ConfigConstants.SEARCHGUARD_AUTHCZ_IMPERSONATION_DN+"."); final Settings impersonationUsersRest = settings.getByPrefix(ConfigConstants.SEARCHGUARD_AUTHCZ_REST_IMPERSONATION_USERS+".");
&& settings.getByPrefix("tribe").size() > 0) { getThreadContext().putHeader("_sg_header_tn", "true");
if(log.isDebugEnabled() && this.settings.getByPrefix("tribe").size() > 0) { log.debug("Tribe configuration detected: {}", this.settings); boolean tribeNode = this.settings.get("tribe.name", null) == null && this.settings.getByPrefix("tribe").size() > 0; tribeNodeClient = this.settings.get("tribe.name", null) != null;
|| rolesMappingResolution == ConfigConstants.RolesMappingResolution.MAPPING_ONLY))) { for (final String roleMap : rolesMapping.names()) { final Settings roleMapSettings = rolesMapping.getByPrefix(roleMap);
/** * Returns the settings mapped to the given setting name. */ public Settings getAsSettings(String setting) { return getByPrefix(setting + "."); }
final Settings sgRoleSettings = settings.getByPrefix(sgRole); if (sgRoleSettings.names().isEmpty()) { continue; _sgRole.addClusterPerms(permittedClusterActions); Settings tenants = settings.getByPrefix(sgRole+".tenants.");
@Override public Settings get(Settings settings) { Settings byPrefix = settings.getByPrefix(getKey()); validator.accept(byPrefix); return byPrefix; }
private Map<String, Settings> getGroupsInternal(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException { Settings prefixSettings = getByPrefix(settingPrefix); Map<String, Settings> groups = new HashMap<>(); for (String groupName : prefixSettings.names()) { Settings groupSettings = prefixSettings.getByPrefix(groupName + "."); if (groupSettings.isEmpty()) { if (ignoreNonGrouped) { continue; } throw new SettingsException("Failed to get setting group for [" + settingPrefix + "] setting prefix and setting [" + settingPrefix + groupName + "] because of a missing '.'"); } groups.put(groupName, groupSettings); } return Collections.unmodifiableMap(groups); } /**
nodeSettings = loadDictionarySettings(dicDir, dictSettings.getByPrefix(locale + "."));
/** * Returns the settings mapped to the given setting name. */ public Settings getAsSettings(String setting) { return getByPrefix(setting + "."); }
/** * Returns the settings mapped to the given setting name. */ public Settings getAsSettings(String setting) { return getByPrefix(setting + "."); }
/** * Returns the settings mapped to the given setting name. */ public Settings getAsSettings(String setting) { return getByPrefix(setting + "."); }
@Override public ActionRequestValidationException validate() { ActionRequestValidationException validationException = targetIndexRequest == null ? null : targetIndexRequest.validate(); if (sourceIndex == null) { validationException = addValidationError("source index is missing", validationException); } if (targetIndexRequest == null) { validationException = addValidationError("target index request is missing", validationException); } if (targetIndexRequest.settings().getByPrefix("index.sort.").isEmpty() == false) { validationException = addValidationError("can't override index sort when resizing an index", validationException); } if (type == ResizeType.SPLIT && IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexRequest.settings()) == false) { validationException = addValidationError("index.number_of_shards is required for split operations", validationException); } assert copySettings == null || copySettings; return validationException; }
@Override public Settings get(Settings settings) { Settings byPrefix = settings.getByPrefix(getKey()); validator.accept(byPrefix); return byPrefix; }
private String getSettingString(String key) throws Exception { Settings s = settings.getByPrefix(ElasticfenceSettings.SETTINGS_PREFIX); String value = s.get(key); //EFLogger.info(SETTINGS_PREFIX + key + " value: " + value); if (value == null) { throw new Exception(key + " is not defined in settings!"); } return value; }
private String[] getSettingArray(String key, String[] defaultValue) throws Exception { Settings s = settings.getByPrefix(ElasticfenceSettings.SETTINGS_PREFIX); String[] value = s.getAsArray(key, defaultValue); if (value == null || value.length == 0) { EFLogger.warn(key + " is not defined in settings, setting default value of " + Arrays.toString(defaultValue)); return defaultValue; } //EFLogger.info(key + ": " + Arrays.toString(value)); return value; }
private int getSettingInt(String key, int defaultValue) throws Exception { Settings s = settings.getByPrefix(ElasticfenceSettings.SETTINGS_PREFIX); int value = s.getAsInt(key, defaultValue); if (value == defaultValue) { EFLogger.warn(key + " is set to the default value of " + defaultValue); } return value; }
@Inject protected InsightIndicesHousekeeperService(Settings settings, ThreadPool threadPool, AdminClient adminClient) { super(settings); this.threadPool = threadPool; this.adminClient = adminClient; this.settings = settings.getByPrefix("insight.indices.management."); indicesPrefix = this.settings.get("prefix", "insight"); daysOpened = this.settings.getAsInt("opened", 7); daysClosed = this.settings.getAsInt("closed", 14); daysStored = this.settings.getAsInt("stored", 0); interval = TimeValue.parseTimeValue(settings.get("interval"), TimeValue.timeValueHours(1)); logger.info("Initialized {}", getClass().getSimpleName()); }