in src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/ModifyAceServlet.java [539:567]
protected LocalRestriction toLocalRestriction(
@NotNull SlingHttpServletRequest request,
@NotNull Map<String, RestrictionDefinition> srMap,
@NotNull String restrictionName,
@NotNull String paramName) throws RepositoryException {
RestrictionDefinition rd = srMap.get(restrictionName);
if (rd == null) {
//illegal restriction name?
throw new AccessControlException(INVALID_OR_NOT_SUPPORTED_RESTRICTION_NAME_WAS_SUPPLIED);
}
Session session = request.getResourceResolver().adaptTo(Session.class);
ValueFactory vf = session.getValueFactory();
LocalRestriction localRestriction;
int restrictionType = rd.getRequiredType().tag();
if (rd.getRequiredType().isArray()) {
// multi-value
String[] parameterValues = request.getParameterValues(paramName);
Value[] restrictionValue = new Value[parameterValues.length];
for (int i = 0; i < parameterValues.length; i++) {
restrictionValue[i] = vf.createValue(parameterValues[i], restrictionType);
}
localRestriction = new LocalRestriction(rd, restrictionValue);
} else {
// single value
Value restrictionValue = vf.createValue(request.getParameter(paramName), restrictionType);
localRestriction = new LocalRestriction(rd, restrictionValue);
}
return localRestriction;
}