@Deprecated @Override public boolean containsKey( String key ) { return config.getValue( key ).isPresent(); }
@Deprecated @Override public Object getProperty( String key ) { return config.getValue( key ).orElse( null ); }
private <T> List<T> parseMatchers( String configName, Config config, String delimiter, Function<String,T> matchFunc ) { String fullAccessProcedures = config.getValue( configName ).map( Object::toString ).orElse( "" ); if ( fullAccessProcedures.isEmpty() ) { return Collections.emptyList(); } else { return Stream.of( fullAccessProcedures.split( delimiter ) ).map( matchFunc ) .collect( Collectors.toList() ); } }
public ProcedureConfig( Config config ) { this.defaultValue = config.getValue( PROC_ALLOWED_SETTING_DEFAULT_NAME ) .map( Object::toString ) .orElse( "" ); String allowedRoles = config.getValue( PROC_ALLOWED_SETTING_ROLES ).map( Object::toString ) .orElse( "" ); this.matchers = Stream.of( allowedRoles.split( SETTING_DELIMITER ) ) .map( procToRoleSpec -> procToRoleSpec.split( MAPPING_DELIMITER ) ) .filter( spec -> spec.length > 1 ) .map( spec -> { String[] roles = stream( spec[1].split( ROLES_DELIMITER ) ).map( String::trim ).toArray( String[]::new ); return new ProcMatcher( spec[0].trim(), roles ); } ).collect( Collectors.toList() ); this.accessPatterns = parseMatchers( GraphDatabaseSettings.procedure_unrestricted.name(), config, PROCEDURE_DELIMITER, ProcedureConfig::compilePattern ); this.whiteList = parseMatchers( GraphDatabaseSettings.procedure_whitelist.name(), config, PROCEDURE_DELIMITER, ProcedureConfig::compilePattern ); this.defaultTemporalTimeZone = config.get( GraphDatabaseSettings.db_temporal_timezone ); }
public static void initialize(GraphDatabaseAPI db) { Static.clear(); Config neo4jConfig = db.getDependencyResolver().resolveDependency(Config.class); Map<String, String> params = neo4jConfig.getRaw(); apocConfig.clear(); apocConfig.putAll(Util.subMap(params, PREFIX)); PARAM_WHITELIST.forEach((k, v) -> { Optional<Object> configValue = neo4jConfig.getValue(k); if (configValue.isPresent()) { apocConfig.put(v, configValue.get().toString()); } }); config.clear(); params.forEach((k, v) -> { if (!SKIP.matcher(k).find()) {config.put(k, v);} }); }
@Deprecated @Override public boolean containsKey( String key ) { return config.getValue( key ).isPresent(); }
@Deprecated @Override public Object getProperty( String key ) { return config.getValue( key ).orElse( null ); }
private <T> List<T> parseMatchers( String configName, Config config, String delimiter, Function<String,T> matchFunc ) { String fullAccessProcedures = config.getValue( configName ).map( Object::toString ).orElse( "" ); if ( fullAccessProcedures.isEmpty() ) { return Collections.emptyList(); } else { return Stream.of( fullAccessProcedures.split( delimiter ) ).map( matchFunc ) .collect( Collectors.toList() ); } }
public ProcedureConfig( Config config ) { this.defaultValue = config.getValue( PROC_ALLOWED_SETTING_DEFAULT_NAME ) .map( Object::toString ) .orElse( "" ); String allowedRoles = config.getValue( PROC_ALLOWED_SETTING_ROLES ).map( Object::toString ) .orElse( "" ); this.matchers = Stream.of( allowedRoles.split( SETTING_DELIMITER ) ) .map( procToRoleSpec -> procToRoleSpec.split( MAPPING_DELIMITER ) ) .filter( spec -> spec.length > 1 ) .map( spec -> { String[] roles = stream( spec[1].split( ROLES_DELIMITER ) ).map( String::trim ).toArray( String[]::new ); return new ProcMatcher( spec[0].trim(), roles ); } ).collect( Collectors.toList() ); this.accessPatterns = parseMatchers( GraphDatabaseSettings.procedure_unrestricted.name(), config, PROCEDURE_DELIMITER, ProcedureConfig::compilePattern ); this.whiteList = parseMatchers( GraphDatabaseSettings.procedure_whitelist.name(), config, PROCEDURE_DELIMITER, ProcedureConfig::compilePattern ); this.defaultTemporalTimeZone = config.get( GraphDatabaseSettings.db_temporal_timezone ); }