assertNotNull(aceObject);
String principalString = aceObject.optString("principal");
assertEquals(testUserId, principalString);
JSONArray grantedArray = aceObject.optJSONArray("granted");
assertNotNull(grantedArray);
assertTrue(grantedArray.length() >= 8);
Set<String> grantedPrivilegeNames = new HashSet<String>();
for (int i=0; i < grantedArray.length(); i++) {
grantedPrivilegeNames.add(grantedArray.getString(i));
}
H.assertPrivilege(grantedPrivilegeNames,false,"jcr:all");
H.assertPrivilege(grantedPrivilegeNames,false,"jcr:write");
H.assertPrivilege(grantedPrivilegeNames,true,"jcr:read");
H.assertPrivilege(grantedPrivilegeNames,true,"jcr:readAccessControl");
H.assertPrivilege(grantedPrivilegeNames,true,"jcr:modifyAccessControl");
H.assertPrivilege(grantedPrivilegeNames,true,"jcr:lockManagement");
H.assertPrivilege(grantedPrivilegeNames,true,"jcr:versionManagement");
H.assertPrivilege(grantedPrivilegeNames,true,"jcr:nodeTypeManagement");
H.assertPrivilege(grantedPrivilegeNames,true,"jcr:retentionManagement");
H.assertPrivilege(grantedPrivilegeNames,true,"jcr:lifecycleManagement");
//jcr:write aggregate privileges should be denied
H.assertPrivilege(grantedPrivilegeNames,false,"jcr:modifyProperties");
H.assertPrivilege(grantedPrivilegeNames,false,"jcr:addChildNodes");
H.assertPrivilege(grantedPrivilegeNames,false,"jcr:removeNode");
H.assertPrivilege(grantedPrivilegeNames,false,"jcr:removeChildNodes");
JSONArray deniedArray = aceObject.optJSONArray("denied");
assertNotNull(deniedArray);
assertEquals(1, deniedArray.length());
Set<String> deniedPrivilegeNames = new HashSet<String>();
for (int i=0; i < deniedArray.length(); i++) {
deniedPrivilegeNames.add(deniedArray.getString(i));
}
H.assertPrivilege(deniedPrivilegeNames, true, "jcr:write");
}