- if (userHome != null) {
- String path = userHome.getPath();
- Principal principal = user.getPrincipal();
-
- JackrabbitAccessControlManager acm = (JackrabbitAccessControlManager) getSystemSession()
- .getAccessControlManager();
- JackrabbitAccessControlPolicy[] ps = acm
- .getApplicablePolicies(principal);
- if (ps.length == 0) {
- log.warn("No ACL found for " + user);
- return;
- }
-
- JackrabbitAccessControlList list = (JackrabbitAccessControlList) ps[0];
-
- // add entry
- Privilege[] privileges = new Privilege[] { acm
- .privilegeFromName(Privilege.JCR_ALL) };
- Map<String, Value> restrictions = new HashMap<String, Value>();
- ValueFactory vf = getSystemSession().getValueFactory();
- restrictions.put("rep:nodePath",
- vf.createValue(path, PropertyType.PATH));
- restrictions.put("rep:glob", vf.createValue("*"));
- list.addEntry(principal, privileges, true /* allow or deny */,
- restrictions);
- }
+ JackrabbitAccessControlList list = (JackrabbitAccessControlList) ps[0];
+
+ // add entry
+ Privilege[] privileges = new Privilege[] { acm
+ .privilegeFromName(Privilege.JCR_READ) };
+ Map<String, Value> restrictions = new HashMap<String, Value>();
+ ValueFactory vf = getSystemSession().getValueFactory();
+ restrictions.put("rep:nodePath",
+ vf.createValue(path, PropertyType.PATH));
+ restrictions.put("rep:glob", vf.createValue("*"));
+ list.addEntry(principal, privileges, true /* allow or deny */,
+ restrictions);