core/src/main/java/org/sakaiproject/nakamura/api/lite/accesscontrol/AclModification.java
public static void filterAcl(Map<String, Object> acl, boolean grant, Permission permission,
            boolean set, List<AclModification> modifications) {
        int perm = permission.getPermission();
        Operation op = Operation.OP_OR;
        if (!set) {
            perm = 0xffff ^ perm;
            op = Operation.OP_AND;
        }
        for (Entry<String, Object> ace : acl.entrySet()) {
            String key = ace.getKey();
            if (AclModification.isGrant(key) == grant) {
                // clear the bit if set.
                modifications.add(new AclModification(key, perm, op));
            }
        }
    }
public static void filterAcl(Map<String, Object> acl, boolean grant, Permission permission,
            boolean set, List<AclModification> modifications) {
        int perm = permission.getPermission();
        Operation op = Operation.OP_OR;
        if (!set) {
            perm = 0xffff ^ perm;
            op = Operation.OP_AND;
        }
        for (Entry<String, Object> ace : acl.entrySet()) {
            String key = ace.getKey();
            if (AclModification.isGrant(key) == grant) {
                // clear the bit if set.
                modifications.add(new AclModification(key, perm, op));
            }
        }
    }
TODO: Unit test