protected Map < String , Role > parseDefinedRoles ( Config config ) { // Parse the defined Roles Map < String , Role > roleMap = new HashMap <> ( ) ; if ( ! config . hasPath ( "roles" ) ) { log . trace ( "'{}' has no roles" , config ) ; } else if ( config . hasPath ( "roles" ) ) { log . trace ( "Parsing Role definitions" ) ; Config roleConfig = config . getConfig ( "roles" ) ; for ( Map . Entry < String , ConfigValue > entry : roleConfig . entrySet ( ) ) { String name = entry . getKey ( ) ; List < String > permissions = roleConfig . getStringList ( name ) ; Role role = new Role ( name , permissions . toArray ( new String [ permissions . size ( ) ] ) ) ; roleMap . put ( role . getName ( ) , role ) ; } } return Collections . unmodifiableMap ( roleMap ) ; }
Parse the Roles specified in the Config object .