}
// set up permissions
String permissionsPath = session.getRootNode().getPath();
AccessControlManager accessControlManager = session
.getAccessControlManager();
AccessControlPolicyIterator acls = accessControlManager
.getApplicablePolicies(permissionsPath);
if (acls.hasNext()) {
JackrabbitAccessControlList acl = (JackrabbitAccessControlList) acls
.nextAccessControlPolicy();
acl.addEntry(user.getPrincipal(), accessControlManager
.getSupportedPrivileges(permissionsPath), true);
accessControlManager.setPolicy(permissionsPath, acl);
} else {