if (subject != null) {
principals = subject.getPrincipals();
}
AccessControlContext context = new AccessControlContextImpl();
context.initialize(principals);
NodeUtil rootBefore = new NodeUtil(new ReadOnlyTree(before));
NodeUtil rootAfter = new NodeUtil(new ReadOnlyTree(after));
return new PermissionValidator(context.getPermissions(), rootBefore, rootAfter);
}