code: public Map<String, Permission> ymlToPermissions(String yml, String msName) {
          Map<String, Permission> result = new TreeMap<>();
          try {
              Map<String, Map<String, Set<Permission>>> map = mapper
                  .readValue(yml, new TypeReference<TreeMap<String, TreeMap<String, TreeSet<Permission>>>>() {
                  });
              map.entrySet().stream()
                  .filter(entry -> StringUtils.isBlank(msName) || StringUtils.startsWithIgnoreCase(entry.getKey(), msName))
                  .filter(entry -> entry.getValue() != null)
                  .forEach(entry -> entry.getValue()
                      .forEach((roleKey, permissions) ->
                                   permissions.forEach(permission -> {
                                       permission.setMsName(entry.getKey());
                                       permission.setRoleKey(roleKey);
                                       result.put(roleKey + ":" + permission.getPrivilegeKey(), permission);
                                   })
                      ));
          } catch (Exception e) {
              log.error("Failed to create permissions collection from YML file, error: {}", e.getMessage(), e);
          }
          return Collections.unmodifiableMap(result);
      }
docs: Convert permissions yml string to map with role and privilege keys.
  Return map fo specific service or all.
  
  @param yml    string
  @param msName service name
  @return permissions map