syncbase/src/main/java/io/v/syncbase/AccessList.java
/**
     * Computes a new parsed permissions map from the original Permissions object based on delta.
     */
Computes a new parsed permissions map from the original Permissions object based on delta.
Computes a new parsed permissions map from the original Permissions object based on delta .
private static Map<String, Map<String, Set<String>>> applyDeltaParsed(
            Permissions corePermissions, AccessList delta){
        Map<String, Map<String, Set<String>>> parsedPermissions = corePermissions.parse();
        for (String userId : delta.users.keySet()) {
            AccessLevel level = delta.users.get(userId);
            String blessing = Syncbase.getBlessingStringFromAlias(userId);
            if (level == null) {
                removeFromVAccessList(parsedPermissions.get(Permissions.Tags.RESOLVE), blessing);
                removeFromVAccessList(parsedPermissions.get(Permissions.Tags.READ), blessing);
                removeFromVAccessList(parsedPermissions.get(Permissions.Tags.WRITE), blessing);
                removeFromVAccessList(parsedPermissions.get(Permissions.Tags.ADMIN), blessing);
                continue;
            }
            switch (level) {
                case READ:
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.RESOLVE), blessing);
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.READ), blessing);
                    removeFromVAccessList(parsedPermissions.get(Permissions.Tags.WRITE), blessing);
                    removeFromVAccessList(parsedPermissions.get(Permissions.Tags.ADMIN), blessing);
                    break;
                case READ_WRITE:
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.RESOLVE), blessing);
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.READ), blessing);
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.WRITE), blessing);
                    removeFromVAccessList(parsedPermissions.get(Permissions.Tags.ADMIN), blessing);
                    break;
                case READ_WRITE_ADMIN:
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.RESOLVE), blessing);
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.READ), blessing);
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.WRITE), blessing);
                    addToVAccessList(parsedPermissions.get(Permissions.Tags.ADMIN), blessing);
                    break;
            }
        }
        return parsedPermissions;
    }
private static Map < String , Map < String , Set < String > > > applyDeltaParsed ( Permissions corePermissions , AccessList delta ) { Map < String , Map < String , Set < String > > > parsedPermissions = corePermissions . parse ( ) ; for ( String userId : delta . users . keySet ( ) ) { AccessLevel level = delta . users . get ( userId ) ; String blessing = Syncbase . getBlessingStringFromAlias ( userId ) ; if ( level == null ) { removeFromVAccessList ( parsedPermissions . get ( Permissions . Tags . RESOLVE ) , blessing ) ; removeFromVAccessList ( parsedPermissions . get ( Permissions . Tags . READ ) , blessing ) ; removeFromVAccessList ( parsedPermissions . get ( Permissions . Tags . WRITE ) , blessing ) ; removeFromVAccessList ( parsedPermissions . get ( Permissions . Tags . ADMIN ) , blessing ) ; continue ; } switch ( level ) { case READ : addToVAccessList ( parsedPermissions . get ( Permissions . Tags . RESOLVE ) , blessing ) ; addToVAccessList ( parsedPermissions . get ( Permissions . Tags . READ ) , blessing ) ; removeFromVAccessList ( parsedPermissions . get ( Permissions . Tags . WRITE ) , blessing ) ; removeFromVAccessList ( parsedPermissions . get ( Permissions . Tags . ADMIN ) , blessing ) ; break ; case READ_WRITE : addToVAccessList ( parsedPermissions . get ( Permissions . Tags . RESOLVE ) , blessing ) ; addToVAccessList ( parsedPermissions . get ( Permissions . Tags . READ ) , blessing ) ; addToVAccessList ( parsedPermissions . get ( Permissions . Tags . WRITE ) , blessing ) ; removeFromVAccessList ( parsedPermissions . get ( Permissions . Tags . ADMIN ) , blessing ) ; break ; case READ_WRITE_ADMIN : addToVAccessList ( parsedPermissions . get ( Permissions . Tags . RESOLVE ) , blessing ) ; addToVAccessList ( parsedPermissions . get ( Permissions . Tags . READ ) , blessing ) ; addToVAccessList ( parsedPermissions . get ( Permissions . Tags . WRITE ) , blessing ) ; addToVAccessList ( parsedPermissions . get ( Permissions . Tags . ADMIN ) , blessing ) ; break ; } } return parsedPermissions ; }
Computes a new parsed permissions map from the original Permissions object based on delta.
Computes a new parsed permissions map from the original Permissions object based on delta .