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 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 ); }