syncbase/src/main/java/io/v/syncbase/core/Permissions.java
/**
     * Parses the JSON string and returns a map describing the permissions.
     * <p/>
     * Example:
     * <p/>
     * <pre>
     * {
     *      "Admin":{"In":["..."]},
     *      "Write":{"In":["..."]},
     *      "Read":{"In":["..."]},
     *      "Resolve":{"In":["..."]},
     *      "Debug":{"In":["..."]}
     * }
     * </pre>
     *
     * @return map describing the permissions
     */
Parses the JSON string and returns a map describing the permissions.

@return map describing the permissions
Parses the JSON string and returns a map describing the permissions . @return map describing the permissions
public Map<String, Map<String, Set<String>>> parse() {
        Map<String, Map<String, Set<String>>> permissions = new HashMap<>();
        try {
            JSONObject jsonObject = new JSONObject(new String(this.json));
            for (Iterator<String> iter = jsonObject.keys(); iter.hasNext(); ) {
                String tag = iter.next();
                permissions.put(tag, parseAccessList(jsonObject.getJSONObject(tag)));
            }
        } catch (JSONException e) {
            throw new IllegalArgumentException("Permissions parsing failure", e);
        }
        initializeAccessList(permissions, Tags.ADMIN);
        initializeAccessList(permissions, Tags.WRITE);
        initializeAccessList(permissions, Tags.READ);
        initializeAccessList(permissions, Tags.RESOLVE);
        return permissions;
    }
public Map < String , Map < String , Set < String > > > parse ( ) { Map < String , Map < String , Set < String > > > permissions = new HashMap < > ( ) ; try { JSONObject jsonObject = new JSONObject ( new String ( this . json ) ) ; for ( Iterator < String > iter = jsonObject . keys ( ) ; iter . hasNext ( ) ; ) { String tag = iter . next ( ) ; permissions . put ( tag , parseAccessList ( jsonObject . getJSONObject ( tag ) ) ) ; } } catch ( JSONException e ) { throw new IllegalArgumentException ( "Permissions parsing failure" , e ) ; } initializeAccessList ( permissions , Tags . ADMIN ) ; initializeAccessList ( permissions , Tags . WRITE ) ; initializeAccessList ( permissions , Tags . READ ) ; initializeAccessList ( permissions , Tags . RESOLVE ) ; return permissions ; }
Parses the JSON string and returns a map describing the permissions.
Parses the JSON string and returns a map describing the permissions .
// TODO(razvanm): Should we do something else? Logging? // Initialize all the parts we missed out on.