private void createPrincipal()

in src/main/java/org/apache/sling/jcr/contentloader/internal/readers/JsonReader.java [398:427]


    private void createPrincipal(JsonObject json, ContentCreator contentCreator) throws RepositoryException {
        // create a principal
        String name = json.getString("name");
        boolean isGroup = json.getBoolean("isgroup", false);

        // collect the extra property names to assign to the new principal
        Map<String, Object> extraProps = new LinkedHashMap<>();
        for (Map.Entry<String, JsonValue> entry : json.entrySet()) {
            String propName = entry.getKey();
            if (!ignoredPrincipalPropertyNames.contains(propName)) {
                Object value = unbox(entry.getValue());
                extraProps.put(propName, value);
            }
        }

        if (isGroup) {
            String[] members = null;
            JsonArray membersJSONArray = (JsonArray) json.get("members");
            if (membersJSONArray != null) {
                members = new String[membersJSONArray.size()];
                for (int i = 0; i < members.length; i++) {
                    members[i] = membersJSONArray.getString(i);
                }
            }
            contentCreator.createGroup(name, members, extraProps);
        } else {
            String password = json.getString("password");
            contentCreator.createUser(name, password, extraProps);
        }
    }