You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ju...@apache.org on 2009/04/24 14:14:15 UTC
svn commit: r768268 [3/6] - in /incubator/sling/trunk:
bundles/api/src/main/java/org/apache/sling/api/
bundles/api/src/main/java/org/apache/sling/api/adapter/
bundles/api/src/main/java/org/apache/sling/api/resource/
bundles/api/src/main/java/org/apache...
Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractAccessPostServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractAccessPostServlet.java?rev=768268&r1=768267&r2=768268&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractAccessPostServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractAccessPostServlet.java Fri Apr 24 12:14:03 2009
@@ -1,254 +1,254 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.jcr.jackrabbit.accessmanager.post;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.ResourceNotFoundException;
-import org.apache.sling.api.resource.ResourceUtil;
-import org.apache.sling.api.servlets.HtmlResponse;
-import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.api.wrappers.SlingRequestPaths;
-import org.apache.sling.servlets.post.Modification;
-import org.apache.sling.servlets.post.SlingPostConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Base class for all the POST servlets for the AccessManager operations
- */
-public abstract class AbstractAccessPostServlet extends SlingAllMethodsServlet {
- private static final long serialVersionUID = -5918670409789895333L;
-
- /**
- * default log
- */
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- /* (non-Javadoc)
- * @see org.apache.sling.api.servlets.SlingAllMethodsServlet#doPost(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.SlingHttpServletResponse)
- */
- @Override
- protected void doPost(SlingHttpServletRequest request,
- SlingHttpServletResponse httpResponse) throws ServletException,
- IOException {
- // prepare the response
- HtmlResponse htmlResponse = new HtmlResponse();
- htmlResponse.setReferer(request.getHeader("referer"));
-
- // calculate the paths
- String path = getItemPath(request);
- htmlResponse.setPath(path);
-
- // location
- htmlResponse.setLocation(externalizePath(request, path));
-
- // parent location
- path = ResourceUtil.getParent(path);
- if (path != null) {
- htmlResponse.setParentLocation(externalizePath(request, path));
- }
-
- Session session = request.getResourceResolver().adaptTo(Session.class);
-
- final List<Modification> changes = new ArrayList<Modification>();
-
- try {
- handleOperation(request, htmlResponse, changes);
-
- //TODO: maybe handle SlingAuthorizablePostProcessor handlers here
-
- // set changes on html response
- for(Modification change : changes) {
- switch ( change.getType() ) {
- case MODIFY : htmlResponse.onModified(change.getSource()); break;
- case DELETE : htmlResponse.onDeleted(change.getSource()); break;
- case MOVE : htmlResponse.onMoved(change.getSource(), change.getDestination()); break;
- case COPY : htmlResponse.onCopied(change.getSource(), change.getDestination()); break;
- case CREATE : htmlResponse.onCreated(change.getSource()); break;
- case ORDER : htmlResponse.onChange("ordered", change.getSource(), change.getDestination()); break;
- }
- }
-
- if (session.hasPendingChanges()) {
- session.save();
- }
- } catch (ResourceNotFoundException rnfe) {
- htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND,
- rnfe.getMessage());
- } catch (Throwable throwable) {
- log.debug("Exception while handling POST "
- + request.getResource().getPath() + " with "
- + getClass().getName(), throwable);
- htmlResponse.setError(throwable);
- } finally {
- try {
- if (session.hasPendingChanges()) {
- session.refresh(false);
- }
- } catch (RepositoryException e) {
- log.warn("RepositoryException in finally block: {}",
- e.getMessage(), e);
- }
- }
-
- // check for redirect URL if processing succeeded
- if (htmlResponse.isSuccessful()) {
- String redirect = getRedirectUrl(request, htmlResponse);
- if (redirect != null) {
- httpResponse.sendRedirect(redirect);
- return;
- }
- }
-
- // create a html response and send if unsuccessful or no redirect
- htmlResponse.send(httpResponse, isSetStatus(request));
- }
-
- /**
- * Extending Servlet should implement this operation to do the work
- *
- * @param request the sling http request to process
- * @param htmlResponse the response
- * @param changes
- */
- abstract protected void handleOperation(SlingHttpServletRequest request,
- HtmlResponse htmlResponse, List<Modification> changes) throws RepositoryException;
-
-
- /**
- * compute redirect URL (SLING-126)
- *
- * @param ctx the post processor
- * @return the redirect location or <code>null</code>
- */
- protected String getRedirectUrl(HttpServletRequest request, HtmlResponse ctx) {
- // redirect param has priority (but see below, magic star)
- String result = request.getParameter(SlingPostConstants.RP_REDIRECT_TO);
- if (result != null && ctx.getPath() != null) {
-
- // redirect to created/modified Resource
- int star = result.indexOf('*');
- if (star >= 0) {
- StringBuffer buf = new StringBuffer();
-
- // anything before the star
- if (star > 0) {
- buf.append(result.substring(0, star));
- }
-
- // append the name of the manipulated node
- buf.append(ResourceUtil.getName(ctx.getPath()));
-
- // anything after the star
- if (star < result.length() - 1) {
- buf.append(result.substring(star + 1));
- }
-
- // use the created path as the redirect result
- result = buf.toString();
-
- } else if (result.endsWith(SlingPostConstants.DEFAULT_CREATE_SUFFIX)) {
- // if the redirect has a trailing slash, append modified node
- // name
- result = result.concat(ResourceUtil.getName(ctx.getPath()));
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Will redirect to " + result);
- }
- }
- return result;
- }
-
- protected boolean isSetStatus(SlingHttpServletRequest request) {
- String statusParam = request.getParameter(SlingPostConstants.RP_STATUS);
- if (statusParam == null) {
- log.debug(
- "getStatusMode: Parameter {} not set, assuming standard status code",
- SlingPostConstants.RP_STATUS);
- return true;
- }
-
- if (SlingPostConstants.STATUS_VALUE_BROWSER.equals(statusParam)) {
- log.debug(
- "getStatusMode: Parameter {} asks for user-friendly status code",
- SlingPostConstants.RP_STATUS);
- return false;
- }
-
- if (SlingPostConstants.STATUS_VALUE_STANDARD.equals(statusParam)) {
- log.debug(
- "getStatusMode: Parameter {} asks for standard status code",
- SlingPostConstants.RP_STATUS);
- return true;
- }
-
- log.debug(
- "getStatusMode: Parameter {} set to unknown value {}, assuming standard status code",
- SlingPostConstants.RP_STATUS);
- return true;
- }
-
- // ------ These methods were copied from AbstractSlingPostOperation ------
-
- /**
- * Returns the path of the resource of the request as the item path.
- * <p>
- * This method may be overwritten by extension if the operation has
- * different requirements on path processing.
- */
- protected String getItemPath(SlingHttpServletRequest request) {
- return request.getResource().getPath();
- }
-
- /**
- * Returns an external form of the given path prepending the context path
- * and appending a display extension.
- *
- * @param path the path to externalize
- * @return the url
- */
- protected final String externalizePath(SlingHttpServletRequest request,
- String path) {
- StringBuffer ret = new StringBuffer();
- ret.append(SlingRequestPaths.getContextPath(request));
- ret.append(request.getResourceResolver().map(path));
-
- // append optional extension
- String ext = request.getParameter(SlingPostConstants.RP_DISPLAY_EXTENSION);
- if (ext != null && ext.length() > 0) {
- if (ext.charAt(0) != '.') {
- ret.append('.');
- }
- ret.append(ext);
- }
-
- return ret.toString();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.jcr.jackrabbit.accessmanager.post;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.ResourceNotFoundException;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.api.servlets.HtmlResponse;
+import org.apache.sling.api.servlets.SlingAllMethodsServlet;
+import org.apache.sling.api.wrappers.SlingRequestPaths;
+import org.apache.sling.servlets.post.Modification;
+import org.apache.sling.servlets.post.SlingPostConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base class for all the POST servlets for the AccessManager operations
+ */
+public abstract class AbstractAccessPostServlet extends SlingAllMethodsServlet {
+ private static final long serialVersionUID = -5918670409789895333L;
+
+ /**
+ * default log
+ */
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ /* (non-Javadoc)
+ * @see org.apache.sling.api.servlets.SlingAllMethodsServlet#doPost(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.SlingHttpServletResponse)
+ */
+ @Override
+ protected void doPost(SlingHttpServletRequest request,
+ SlingHttpServletResponse httpResponse) throws ServletException,
+ IOException {
+ // prepare the response
+ HtmlResponse htmlResponse = new HtmlResponse();
+ htmlResponse.setReferer(request.getHeader("referer"));
+
+ // calculate the paths
+ String path = getItemPath(request);
+ htmlResponse.setPath(path);
+
+ // location
+ htmlResponse.setLocation(externalizePath(request, path));
+
+ // parent location
+ path = ResourceUtil.getParent(path);
+ if (path != null) {
+ htmlResponse.setParentLocation(externalizePath(request, path));
+ }
+
+ Session session = request.getResourceResolver().adaptTo(Session.class);
+
+ final List<Modification> changes = new ArrayList<Modification>();
+
+ try {
+ handleOperation(request, htmlResponse, changes);
+
+ //TODO: maybe handle SlingAuthorizablePostProcessor handlers here
+
+ // set changes on html response
+ for(Modification change : changes) {
+ switch ( change.getType() ) {
+ case MODIFY : htmlResponse.onModified(change.getSource()); break;
+ case DELETE : htmlResponse.onDeleted(change.getSource()); break;
+ case MOVE : htmlResponse.onMoved(change.getSource(), change.getDestination()); break;
+ case COPY : htmlResponse.onCopied(change.getSource(), change.getDestination()); break;
+ case CREATE : htmlResponse.onCreated(change.getSource()); break;
+ case ORDER : htmlResponse.onChange("ordered", change.getSource(), change.getDestination()); break;
+ }
+ }
+
+ if (session.hasPendingChanges()) {
+ session.save();
+ }
+ } catch (ResourceNotFoundException rnfe) {
+ htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND,
+ rnfe.getMessage());
+ } catch (Throwable throwable) {
+ log.debug("Exception while handling POST "
+ + request.getResource().getPath() + " with "
+ + getClass().getName(), throwable);
+ htmlResponse.setError(throwable);
+ } finally {
+ try {
+ if (session.hasPendingChanges()) {
+ session.refresh(false);
+ }
+ } catch (RepositoryException e) {
+ log.warn("RepositoryException in finally block: {}",
+ e.getMessage(), e);
+ }
+ }
+
+ // check for redirect URL if processing succeeded
+ if (htmlResponse.isSuccessful()) {
+ String redirect = getRedirectUrl(request, htmlResponse);
+ if (redirect != null) {
+ httpResponse.sendRedirect(redirect);
+ return;
+ }
+ }
+
+ // create a html response and send if unsuccessful or no redirect
+ htmlResponse.send(httpResponse, isSetStatus(request));
+ }
+
+ /**
+ * Extending Servlet should implement this operation to do the work
+ *
+ * @param request the sling http request to process
+ * @param htmlResponse the response
+ * @param changes
+ */
+ abstract protected void handleOperation(SlingHttpServletRequest request,
+ HtmlResponse htmlResponse, List<Modification> changes) throws RepositoryException;
+
+
+ /**
+ * compute redirect URL (SLING-126)
+ *
+ * @param ctx the post processor
+ * @return the redirect location or <code>null</code>
+ */
+ protected String getRedirectUrl(HttpServletRequest request, HtmlResponse ctx) {
+ // redirect param has priority (but see below, magic star)
+ String result = request.getParameter(SlingPostConstants.RP_REDIRECT_TO);
+ if (result != null && ctx.getPath() != null) {
+
+ // redirect to created/modified Resource
+ int star = result.indexOf('*');
+ if (star >= 0) {
+ StringBuffer buf = new StringBuffer();
+
+ // anything before the star
+ if (star > 0) {
+ buf.append(result.substring(0, star));
+ }
+
+ // append the name of the manipulated node
+ buf.append(ResourceUtil.getName(ctx.getPath()));
+
+ // anything after the star
+ if (star < result.length() - 1) {
+ buf.append(result.substring(star + 1));
+ }
+
+ // use the created path as the redirect result
+ result = buf.toString();
+
+ } else if (result.endsWith(SlingPostConstants.DEFAULT_CREATE_SUFFIX)) {
+ // if the redirect has a trailing slash, append modified node
+ // name
+ result = result.concat(ResourceUtil.getName(ctx.getPath()));
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will redirect to " + result);
+ }
+ }
+ return result;
+ }
+
+ protected boolean isSetStatus(SlingHttpServletRequest request) {
+ String statusParam = request.getParameter(SlingPostConstants.RP_STATUS);
+ if (statusParam == null) {
+ log.debug(
+ "getStatusMode: Parameter {} not set, assuming standard status code",
+ SlingPostConstants.RP_STATUS);
+ return true;
+ }
+
+ if (SlingPostConstants.STATUS_VALUE_BROWSER.equals(statusParam)) {
+ log.debug(
+ "getStatusMode: Parameter {} asks for user-friendly status code",
+ SlingPostConstants.RP_STATUS);
+ return false;
+ }
+
+ if (SlingPostConstants.STATUS_VALUE_STANDARD.equals(statusParam)) {
+ log.debug(
+ "getStatusMode: Parameter {} asks for standard status code",
+ SlingPostConstants.RP_STATUS);
+ return true;
+ }
+
+ log.debug(
+ "getStatusMode: Parameter {} set to unknown value {}, assuming standard status code",
+ SlingPostConstants.RP_STATUS);
+ return true;
+ }
+
+ // ------ These methods were copied from AbstractSlingPostOperation ------
+
+ /**
+ * Returns the path of the resource of the request as the item path.
+ * <p>
+ * This method may be overwritten by extension if the operation has
+ * different requirements on path processing.
+ */
+ protected String getItemPath(SlingHttpServletRequest request) {
+ return request.getResource().getPath();
+ }
+
+ /**
+ * Returns an external form of the given path prepending the context path
+ * and appending a display extension.
+ *
+ * @param path the path to externalize
+ * @return the url
+ */
+ protected final String externalizePath(SlingHttpServletRequest request,
+ String path) {
+ StringBuffer ret = new StringBuffer();
+ ret.append(SlingRequestPaths.getContextPath(request));
+ ret.append(request.getResourceResolver().map(path));
+
+ // append optional extension
+ String ext = request.getParameter(SlingPostConstants.RP_DISPLAY_EXTENSION);
+ if (ext != null && ext.length() > 0) {
+ if (ext.charAt(0) != '.') {
+ ret.append('.');
+ }
+ ret.append(ext);
+ }
+
+ return ret.toString();
+ }
+
+}
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/AbstractAccessPostServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/DeleteAcesServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/DeleteAcesServlet.java?rev=768268&r1=768267&r2=768268&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/DeleteAcesServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/DeleteAcesServlet.java Fri Apr 24 12:14:03 2009
@@ -1,128 +1,128 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.jcr.jackrabbit.accessmanager.post;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.jcr.Item;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.jackrabbit.api.jsr283.security.AccessControlEntry;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlList;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlManager;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicy;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicyIterator;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceNotFoundException;
-import org.apache.sling.api.servlets.HtmlResponse;
-import org.apache.sling.jcr.base.util.AccessControlUtil;
-import org.apache.sling.servlets.post.Modification;
-import org.apache.sling.servlets.post.SlingPostConstants;
-
-/**
- * Sling Post Servlet implementation for deleting the ACE for a set of principals on
- * a JCR resource.
- *
- * @scr.component immediate="true"
- * @scr.service interface="javax.servlet.Servlet"
- * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
- * @scr.property name="sling.servlet.methods" value="POST"
- * @scr.property name="sling.servlet.selectors" value="deleteAce"
- */
-public class DeleteAcesServlet extends AbstractAccessPostServlet {
- private static final long serialVersionUID = 3784866802938282971L;
-
- /* (non-Javadoc)
- * @see org.apache.sling.jackrabbit.accessmanager.post.AbstractAccessPostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
- */
- @Override
- protected void handleOperation(SlingHttpServletRequest request,
- HtmlResponse htmlResponse, List<Modification> changes)
- throws RepositoryException {
-
- String[] applyTo = request.getParameterValues(SlingPostConstants.RP_APPLY_TO);
- if (applyTo == null) {
- throw new RepositoryException("principalIds were not sumitted.");
- } else {
- String resourcePath = null;
- Resource resource = request.getResource();
- if (resource == null) {
- throw new ResourceNotFoundException("Resource not found.");
- } else {
- Item item = resource.adaptTo(Item.class);
- if (item != null) {
- resourcePath = item.getPath();
- } else {
- throw new ResourceNotFoundException("Resource is not a JCR Node");
- }
- }
-
- Session session = request.getResourceResolver().adaptTo(Session.class);
- if (session == null) {
- throw new RepositoryException("JCR Session not found");
- }
-
- //load the principalIds array into a set for quick lookup below
- Set<String> pidSet = new HashSet<String>();
- pidSet.addAll(Arrays.asList(applyTo));
-
- try {
- AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
- AccessControlList updatedAcl = null;
- AccessControlPolicyIterator applicablePolicies = accessControlManager.getApplicablePolicies(resourcePath);
- while (applicablePolicies.hasNext()) {
- AccessControlPolicy policy = applicablePolicies.nextAccessControlPolicy();
- if (policy instanceof AccessControlList) {
- updatedAcl = (AccessControlList)policy;
- break;
- }
- }
- if (updatedAcl == null) {
- throw new RepositoryException("Unable to find an access control policy to update.");
- }
-
- //keep track of the existing Aces for the target principal
- AccessControlEntry[] accessControlEntries = updatedAcl.getAccessControlEntries();
- List<AccessControlEntry> oldAces = new ArrayList<AccessControlEntry>();
- for (AccessControlEntry ace : accessControlEntries) {
- if (pidSet.contains(ace.getPrincipal().getName())) {
- oldAces.add(ace);
- }
- }
-
- //remove the old aces
- if (!oldAces.isEmpty()) {
- for (AccessControlEntry ace : oldAces) {
- updatedAcl.removeAccessControlEntry(ace);
- }
- }
-
- //apply the changed policy
- accessControlManager.setPolicy(resourcePath, updatedAcl);
- } catch (RepositoryException re) {
- throw new RepositoryException("Failed to delete access control.", re);
- }
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.jcr.jackrabbit.accessmanager.post;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.jcr.Item;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.api.jsr283.security.AccessControlEntry;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlList;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlManager;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicy;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicyIterator;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceNotFoundException;
+import org.apache.sling.api.servlets.HtmlResponse;
+import org.apache.sling.jcr.base.util.AccessControlUtil;
+import org.apache.sling.servlets.post.Modification;
+import org.apache.sling.servlets.post.SlingPostConstants;
+
+/**
+ * Sling Post Servlet implementation for deleting the ACE for a set of principals on
+ * a JCR resource.
+ *
+ * @scr.component immediate="true"
+ * @scr.service interface="javax.servlet.Servlet"
+ * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
+ * @scr.property name="sling.servlet.methods" value="POST"
+ * @scr.property name="sling.servlet.selectors" value="deleteAce"
+ */
+public class DeleteAcesServlet extends AbstractAccessPostServlet {
+ private static final long serialVersionUID = 3784866802938282971L;
+
+ /* (non-Javadoc)
+ * @see org.apache.sling.jackrabbit.accessmanager.post.AbstractAccessPostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
+ */
+ @Override
+ protected void handleOperation(SlingHttpServletRequest request,
+ HtmlResponse htmlResponse, List<Modification> changes)
+ throws RepositoryException {
+
+ String[] applyTo = request.getParameterValues(SlingPostConstants.RP_APPLY_TO);
+ if (applyTo == null) {
+ throw new RepositoryException("principalIds were not sumitted.");
+ } else {
+ String resourcePath = null;
+ Resource resource = request.getResource();
+ if (resource == null) {
+ throw new ResourceNotFoundException("Resource not found.");
+ } else {
+ Item item = resource.adaptTo(Item.class);
+ if (item != null) {
+ resourcePath = item.getPath();
+ } else {
+ throw new ResourceNotFoundException("Resource is not a JCR Node");
+ }
+ }
+
+ Session session = request.getResourceResolver().adaptTo(Session.class);
+ if (session == null) {
+ throw new RepositoryException("JCR Session not found");
+ }
+
+ //load the principalIds array into a set for quick lookup below
+ Set<String> pidSet = new HashSet<String>();
+ pidSet.addAll(Arrays.asList(applyTo));
+
+ try {
+ AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
+ AccessControlList updatedAcl = null;
+ AccessControlPolicyIterator applicablePolicies = accessControlManager.getApplicablePolicies(resourcePath);
+ while (applicablePolicies.hasNext()) {
+ AccessControlPolicy policy = applicablePolicies.nextAccessControlPolicy();
+ if (policy instanceof AccessControlList) {
+ updatedAcl = (AccessControlList)policy;
+ break;
+ }
+ }
+ if (updatedAcl == null) {
+ throw new RepositoryException("Unable to find an access control policy to update.");
+ }
+
+ //keep track of the existing Aces for the target principal
+ AccessControlEntry[] accessControlEntries = updatedAcl.getAccessControlEntries();
+ List<AccessControlEntry> oldAces = new ArrayList<AccessControlEntry>();
+ for (AccessControlEntry ace : accessControlEntries) {
+ if (pidSet.contains(ace.getPrincipal().getName())) {
+ oldAces.add(ace);
+ }
+ }
+
+ //remove the old aces
+ if (!oldAces.isEmpty()) {
+ for (AccessControlEntry ace : oldAces) {
+ updatedAcl.removeAccessControlEntry(ace);
+ }
+ }
+
+ //apply the changed policy
+ accessControlManager.setPolicy(resourcePath, updatedAcl);
+ } catch (RepositoryException re) {
+ throw new RepositoryException("Failed to delete access control.", re);
+ }
+ }
+ }
+
+}
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/DeleteAcesServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java?rev=768268&r1=768267&r2=768268&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java Fri Apr 24 12:14:03 2009
@@ -1,180 +1,180 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.jcr.jackrabbit.accessmanager.post;
-
-import java.io.IOException;
-import java.security.Principal;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.Item;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.jackrabbit.api.jsr283.security.AccessControlEntry;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlList;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlManager;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicy;
-import org.apache.jackrabbit.api.jsr283.security.Privilege;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceNotFoundException;
-import org.apache.sling.api.servlets.SlingAllMethodsServlet;
-import org.apache.sling.commons.json.JSONObject;
-import org.apache.sling.jcr.base.util.AccessControlUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Sling GET servlet implementation for dumping the declared ACL of a resource
- * to JSON.
- *
- * @scr.component immediate="true"
- * @scr.service interface="javax.servlet.Servlet"
- * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
- * @scr.property name="sling.servlet.methods" value="GET"
- * @scr.property name="sling.servlet.selectors" value="acl"
- * @scr.property name="sling.servlet.extensions " value="json"
- */
-public class GetAclServlet extends SlingAllMethodsServlet {
- private static final long serialVersionUID = 3391376559396223184L;
-
- /**
- * default log
- */
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- /* (non-Javadoc)
- * @see org.apache.sling.api.servlets.SlingSafeMethodsServlet#doGet(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.SlingHttpServletResponse)
- */
- @Override
- protected void doGet(SlingHttpServletRequest request,
- SlingHttpServletResponse response) throws ServletException,
- IOException {
-
- try {
- Session session = request.getResourceResolver().adaptTo(Session.class);
- if (session == null) {
- throw new RepositoryException("JCR Session not found");
- }
-
- String resourcePath = null;
- Resource resource = request.getResource();
- if (resource == null) {
- throw new ResourceNotFoundException("Resource not found.");
- } else {
- Item item = resource.adaptTo(Item.class);
- if (item != null) {
- resourcePath = item.getPath();
- } else {
- throw new ResourceNotFoundException("Resource is not a JCR Node");
- }
- }
-
- AccessControlEntry[] declaredAccessControlEntries = getDeclaredAccessControlEntries(session, resourcePath);
- Map<String, Map<String, Set<String>>> aclMap = new LinkedHashMap<String, Map<String,Set<String>>>();
- for (AccessControlEntry ace : declaredAccessControlEntries) {
- Principal principal = ace.getPrincipal();
- Map<String, Set<String>> map = aclMap.get(principal.getName());
- if (map == null) {
- map = new LinkedHashMap<String, Set<String>>();
- aclMap.put(principal.getName(), map);
- }
-
- boolean allow = AccessControlUtil.isAllow(ace);
- if (allow) {
- Set<String> grantedSet = map.get("granted");
- if (grantedSet == null) {
- grantedSet = new LinkedHashSet<String>();
- map.put("granted", grantedSet);
- }
- Privilege[] privileges = ace.getPrivileges();
- for (Privilege privilege : privileges) {
- grantedSet.add(privilege.getName());
- }
- } else {
- Set<String> deniedSet = map.get("denied");
- if (deniedSet == null) {
- deniedSet = new LinkedHashSet<String>();
- map.put("denied", deniedSet);
- }
- Privilege[] privileges = ace.getPrivileges();
- for (Privilege privilege : privileges) {
- deniedSet.add(privilege.getName());
- }
- }
- }
-
-
- response.setContentType("application/json");
- response.setCharacterEncoding("UTF-8");
-
- JSONObject jsonObj = new JSONObject();
- Set<Entry<String, Map<String, Set<String>>>> entrySet = aclMap.entrySet();
- for (Entry<String, Map<String, Set<String>>> entry : entrySet) {
- String principalName = entry.getKey();
- Map<String, Set<String>> value = entry.getValue();
-
- JSONObject aceObject = new JSONObject();
- Set<String> grantedSet = value.get("granted");
- if (grantedSet != null) {
- aceObject.put("granted", grantedSet);
- }
-
- Set<String> deniedSet = value.get("denied");
- if (deniedSet != null) {
- aceObject.put("denied", deniedSet);
- }
-
- jsonObj.put(principalName, aceObject);
- }
-
-
- // do the dump
- jsonObj.write(response.getWriter());
- } catch (AccessDeniedException ade) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } catch (ResourceNotFoundException rnfe) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, rnfe.getMessage());
- } catch (Throwable throwable) {
- log.debug("Exception while handling GET "
- + request.getResource().getPath() + " with "
- + getClass().getName(), throwable);
- throw new ServletException(throwable);
- }
- }
-
- private AccessControlEntry[] getDeclaredAccessControlEntries(Session session, String absPath) throws RepositoryException {
- AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
- AccessControlPolicy[] policies = accessControlManager.getPolicies(absPath);
- for (AccessControlPolicy accessControlPolicy : policies) {
- if (accessControlPolicy instanceof AccessControlList) {
- AccessControlEntry[] accessControlEntries = ((AccessControlList)accessControlPolicy).getAccessControlEntries();
- return accessControlEntries;
- }
- }
- return new AccessControlEntry[0];
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.jcr.jackrabbit.accessmanager.post;
+
+import java.io.IOException;
+import java.security.Principal;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Item;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jackrabbit.api.jsr283.security.AccessControlEntry;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlList;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlManager;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicy;
+import org.apache.jackrabbit.api.jsr283.security.Privilege;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceNotFoundException;
+import org.apache.sling.api.servlets.SlingAllMethodsServlet;
+import org.apache.sling.commons.json.JSONObject;
+import org.apache.sling.jcr.base.util.AccessControlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Sling GET servlet implementation for dumping the declared ACL of a resource
+ * to JSON.
+ *
+ * @scr.component immediate="true"
+ * @scr.service interface="javax.servlet.Servlet"
+ * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
+ * @scr.property name="sling.servlet.methods" value="GET"
+ * @scr.property name="sling.servlet.selectors" value="acl"
+ * @scr.property name="sling.servlet.extensions " value="json"
+ */
+public class GetAclServlet extends SlingAllMethodsServlet {
+ private static final long serialVersionUID = 3391376559396223184L;
+
+ /**
+ * default log
+ */
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ /* (non-Javadoc)
+ * @see org.apache.sling.api.servlets.SlingSafeMethodsServlet#doGet(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.SlingHttpServletResponse)
+ */
+ @Override
+ protected void doGet(SlingHttpServletRequest request,
+ SlingHttpServletResponse response) throws ServletException,
+ IOException {
+
+ try {
+ Session session = request.getResourceResolver().adaptTo(Session.class);
+ if (session == null) {
+ throw new RepositoryException("JCR Session not found");
+ }
+
+ String resourcePath = null;
+ Resource resource = request.getResource();
+ if (resource == null) {
+ throw new ResourceNotFoundException("Resource not found.");
+ } else {
+ Item item = resource.adaptTo(Item.class);
+ if (item != null) {
+ resourcePath = item.getPath();
+ } else {
+ throw new ResourceNotFoundException("Resource is not a JCR Node");
+ }
+ }
+
+ AccessControlEntry[] declaredAccessControlEntries = getDeclaredAccessControlEntries(session, resourcePath);
+ Map<String, Map<String, Set<String>>> aclMap = new LinkedHashMap<String, Map<String,Set<String>>>();
+ for (AccessControlEntry ace : declaredAccessControlEntries) {
+ Principal principal = ace.getPrincipal();
+ Map<String, Set<String>> map = aclMap.get(principal.getName());
+ if (map == null) {
+ map = new LinkedHashMap<String, Set<String>>();
+ aclMap.put(principal.getName(), map);
+ }
+
+ boolean allow = AccessControlUtil.isAllow(ace);
+ if (allow) {
+ Set<String> grantedSet = map.get("granted");
+ if (grantedSet == null) {
+ grantedSet = new LinkedHashSet<String>();
+ map.put("granted", grantedSet);
+ }
+ Privilege[] privileges = ace.getPrivileges();
+ for (Privilege privilege : privileges) {
+ grantedSet.add(privilege.getName());
+ }
+ } else {
+ Set<String> deniedSet = map.get("denied");
+ if (deniedSet == null) {
+ deniedSet = new LinkedHashSet<String>();
+ map.put("denied", deniedSet);
+ }
+ Privilege[] privileges = ace.getPrivileges();
+ for (Privilege privilege : privileges) {
+ deniedSet.add(privilege.getName());
+ }
+ }
+ }
+
+
+ response.setContentType("application/json");
+ response.setCharacterEncoding("UTF-8");
+
+ JSONObject jsonObj = new JSONObject();
+ Set<Entry<String, Map<String, Set<String>>>> entrySet = aclMap.entrySet();
+ for (Entry<String, Map<String, Set<String>>> entry : entrySet) {
+ String principalName = entry.getKey();
+ Map<String, Set<String>> value = entry.getValue();
+
+ JSONObject aceObject = new JSONObject();
+ Set<String> grantedSet = value.get("granted");
+ if (grantedSet != null) {
+ aceObject.put("granted", grantedSet);
+ }
+
+ Set<String> deniedSet = value.get("denied");
+ if (deniedSet != null) {
+ aceObject.put("denied", deniedSet);
+ }
+
+ jsonObj.put(principalName, aceObject);
+ }
+
+
+ // do the dump
+ jsonObj.write(response.getWriter());
+ } catch (AccessDeniedException ade) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } catch (ResourceNotFoundException rnfe) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, rnfe.getMessage());
+ } catch (Throwable throwable) {
+ log.debug("Exception while handling GET "
+ + request.getResource().getPath() + " with "
+ + getClass().getName(), throwable);
+ throw new ServletException(throwable);
+ }
+ }
+
+ private AccessControlEntry[] getDeclaredAccessControlEntries(Session session, String absPath) throws RepositoryException {
+ AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
+ AccessControlPolicy[] policies = accessControlManager.getPolicies(absPath);
+ for (AccessControlPolicy accessControlPolicy : policies) {
+ if (accessControlPolicy instanceof AccessControlList) {
+ AccessControlEntry[] accessControlEntries = ((AccessControlList)accessControlPolicy).getAccessControlEntries();
+ return accessControlEntries;
+ }
+ }
+ return new AccessControlEntry[0];
+ }
+
+}
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/GetAclServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/ModifyAceServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/ModifyAceServlet.java?rev=768268&r1=768267&r2=768268&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/ModifyAceServlet.java (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/ModifyAceServlet.java Fri Apr 24 12:14:03 2009
@@ -1,241 +1,241 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.jcr.jackrabbit.accessmanager.post;
-
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.jcr.Item;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
-import org.apache.jackrabbit.api.jsr283.security.AccessControlEntry;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlList;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlManager;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicy;
-import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicyIterator;
-import org.apache.jackrabbit.api.jsr283.security.Privilege;
-import org.apache.jackrabbit.api.security.user.Authorizable;
-import org.apache.jackrabbit.api.security.user.UserManager;
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceNotFoundException;
-import org.apache.sling.api.servlets.HtmlResponse;
-import org.apache.sling.jcr.base.util.AccessControlUtil;
-import org.apache.sling.servlets.post.Modification;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Sling Post Servlet implementation for modifying the ACE for a principal on
- * a JCR resource.
- *
- * @scr.component immediate="true"
- * @scr.service interface="javax.servlet.Servlet"
- * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
- * @scr.property name="sling.servlet.methods" value="POST"
- * @scr.property name="sling.servlet.selectors" value="modifyAce"
- */
-public class ModifyAceServlet extends AbstractAccessPostServlet {
- private static final long serialVersionUID = -9182485466670280437L;
-
- /**
- * default log
- */
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- /* (non-Javadoc)
- * @see org.apache.sling.jackrabbit.accessmanager.post.AbstractAccessPostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
- */
- @SuppressWarnings("unchecked")
- @Override
- protected void handleOperation(SlingHttpServletRequest request,
- HtmlResponse htmlResponse, List<Modification> changes)
- throws RepositoryException {
- Session session = request.getResourceResolver().adaptTo(Session.class);
- if (session == null) {
- throw new RepositoryException("JCR Session not found");
- }
-
- String principalId = request.getParameter("principalId");
- if (principalId == null) {
- throw new RepositoryException("principalId was not submitted.");
- }
- UserManager userManager = AccessControlUtil.getUserManager(session);
- Authorizable authorizable = userManager.getAuthorizable(principalId);
- if (authorizable == null) {
- throw new RepositoryException("No principal found for id: " + principalId);
- }
-
- String resourcePath = null;
- Resource resource = request.getResource();
- if (resource == null) {
- throw new ResourceNotFoundException("Resource not found.");
- } else {
- Item item = resource.adaptTo(Item.class);
- if (item != null) {
- resourcePath = item.getPath();
- } else {
- throw new ResourceNotFoundException("Resource is not a JCR Node");
- }
- }
-
-
- List<String> grantedPrivilegeNames = new ArrayList<String>();
- List<String> deniedPrivilegeNames = new ArrayList<String>();
- Enumeration parameterNames = request.getParameterNames();
- while (parameterNames.hasMoreElements()) {
- Object nextElement = parameterNames.nextElement();
- if (nextElement instanceof String) {
- String paramName = (String)nextElement;
- if (paramName.startsWith("privilege@")) {
- String parameterValue = request.getParameter(paramName);
- if (parameterValue != null && parameterValue.length() > 0) {
- if ("granted".equals(parameterValue)) {
- String privilegeName = paramName.substring(10);
- grantedPrivilegeNames.add(privilegeName);
- } else if ("denied".equals(parameterValue)) {
- String privilegeName = paramName.substring(10);
- deniedPrivilegeNames.add(privilegeName);
- }
- }
- }
- }
- }
-
- try {
- AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
- AccessControlList updatedAcl = null;
- AccessControlPolicyIterator applicablePolicies = accessControlManager.getApplicablePolicies(resourcePath);
- while (applicablePolicies.hasNext()) {
- AccessControlPolicy policy = applicablePolicies.nextAccessControlPolicy();
- if (policy instanceof AccessControlList) {
- updatedAcl = (AccessControlList)policy;
- break;
- }
- }
- if (updatedAcl == null) {
- throw new RepositoryException("Unable to find an access conrol policy to update.");
- }
-
- StringBuilder oldPrivileges = null;
- StringBuilder newPrivileges = null;
- if (log.isDebugEnabled()) {
- oldPrivileges = new StringBuilder();
- newPrivileges = new StringBuilder();
- }
-
- //keep track of the existing Aces for the target principal
- AccessControlEntry[] accessControlEntries = updatedAcl.getAccessControlEntries();
- List<AccessControlEntry> oldAces = new ArrayList<AccessControlEntry>();
- for (AccessControlEntry ace : accessControlEntries) {
- if (principalId.equals(ace.getPrincipal().getName())) {
- if (log.isDebugEnabled()) {
- log.debug("Found Existing ACE for principal {0} on resource: ", new Object[] {principalId, resourcePath});
- }
- oldAces.add(ace);
-
- if (log.isDebugEnabled()) {
- //collect the information for debug logging
- boolean isAllow = AccessControlUtil.isAllow(ace);
- Privilege[] privileges = ace.getPrivileges();
- for (Privilege privilege : privileges) {
- if (oldPrivileges.length() > 0) {
- oldPrivileges.append(", "); //separate entries by commas
- }
- if (isAllow) {
- oldPrivileges.append("granted=");
- } else {
- oldPrivileges.append("denied=");
- }
- oldPrivileges.append(privilege.getName());
- }
- }
- }
- }
-
- //remove the old aces
- if (!oldAces.isEmpty()) {
- for (AccessControlEntry ace : oldAces) {
- updatedAcl.removeAccessControlEntry(ace);
- }
- }
-
- //add a fresh ACE with the granted privileges
- List<Privilege> grantedPrivilegeList = new ArrayList<Privilege>();
- for (String name : grantedPrivilegeNames) {
- if (name.length() == 0) {
- continue; //empty, skip it.
- }
- Privilege privilege = accessControlManager.privilegeFromName(name);
- grantedPrivilegeList.add(privilege);
-
- if (log.isDebugEnabled()) {
- if (newPrivileges.length() > 0) {
- newPrivileges.append(", "); //separate entries by commas
- }
- newPrivileges.append("granted=");
- newPrivileges.append(privilege.getName());
- }
- }
- if (grantedPrivilegeList.size() > 0) {
- Principal principal = authorizable.getPrincipal();
- updatedAcl.addAccessControlEntry(principal, grantedPrivilegeList.toArray(new Privilege[grantedPrivilegeList.size()]));
- }
-
- //if the authorizable is a user (not a group) process any denied privileges
- if (!authorizable.isGroup()) {
- //add a fresh ACE with the denied privileges
- List<Privilege> deniedPrivilegeList = new ArrayList<Privilege>();
- for (String name : deniedPrivilegeNames) {
- if (name.length() == 0) {
- continue; //empty, skip it.
- }
- Privilege privilege = accessControlManager.privilegeFromName(name);
- deniedPrivilegeList.add(privilege);
-
- if (log.isDebugEnabled()) {
- if (newPrivileges.length() > 0) {
- newPrivileges.append(", "); //separate entries by commas
- }
- newPrivileges.append("denied=");
- newPrivileges.append(privilege.getName());
- }
- }
- if (deniedPrivilegeList.size() > 0) {
- Principal principal = authorizable.getPrincipal();
- AccessControlUtil.addEntry(updatedAcl, principal, deniedPrivilegeList.toArray(new Privilege[deniedPrivilegeList.size()]), false);
- }
- }
-
- accessControlManager.setPolicy(resourcePath, updatedAcl);
- if (session.hasPendingChanges()) {
- session.save();
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Updated ACE for principalId {0} for resource {1) from {2} to {3}", new Object [] {
- authorizable.getID(), resourcePath, oldPrivileges.toString(), newPrivileges.toString()
- });
- }
- } catch (RepositoryException re) {
- throw new RepositoryException("Failed to create ace.", re);
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.jcr.jackrabbit.accessmanager.post;
+
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.jcr.Item;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.api.jsr283.security.AccessControlEntry;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlList;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlManager;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicy;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlPolicyIterator;
+import org.apache.jackrabbit.api.jsr283.security.Privilege;
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceNotFoundException;
+import org.apache.sling.api.servlets.HtmlResponse;
+import org.apache.sling.jcr.base.util.AccessControlUtil;
+import org.apache.sling.servlets.post.Modification;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Sling Post Servlet implementation for modifying the ACE for a principal on
+ * a JCR resource.
+ *
+ * @scr.component immediate="true"
+ * @scr.service interface="javax.servlet.Servlet"
+ * @scr.property name="sling.servlet.resourceTypes" value="sling/servlet/default"
+ * @scr.property name="sling.servlet.methods" value="POST"
+ * @scr.property name="sling.servlet.selectors" value="modifyAce"
+ */
+public class ModifyAceServlet extends AbstractAccessPostServlet {
+ private static final long serialVersionUID = -9182485466670280437L;
+
+ /**
+ * default log
+ */
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ /* (non-Javadoc)
+ * @see org.apache.sling.jackrabbit.accessmanager.post.AbstractAccessPostServlet#handleOperation(org.apache.sling.api.SlingHttpServletRequest, org.apache.sling.api.servlets.HtmlResponse, java.util.List)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void handleOperation(SlingHttpServletRequest request,
+ HtmlResponse htmlResponse, List<Modification> changes)
+ throws RepositoryException {
+ Session session = request.getResourceResolver().adaptTo(Session.class);
+ if (session == null) {
+ throw new RepositoryException("JCR Session not found");
+ }
+
+ String principalId = request.getParameter("principalId");
+ if (principalId == null) {
+ throw new RepositoryException("principalId was not submitted.");
+ }
+ UserManager userManager = AccessControlUtil.getUserManager(session);
+ Authorizable authorizable = userManager.getAuthorizable(principalId);
+ if (authorizable == null) {
+ throw new RepositoryException("No principal found for id: " + principalId);
+ }
+
+ String resourcePath = null;
+ Resource resource = request.getResource();
+ if (resource == null) {
+ throw new ResourceNotFoundException("Resource not found.");
+ } else {
+ Item item = resource.adaptTo(Item.class);
+ if (item != null) {
+ resourcePath = item.getPath();
+ } else {
+ throw new ResourceNotFoundException("Resource is not a JCR Node");
+ }
+ }
+
+
+ List<String> grantedPrivilegeNames = new ArrayList<String>();
+ List<String> deniedPrivilegeNames = new ArrayList<String>();
+ Enumeration parameterNames = request.getParameterNames();
+ while (parameterNames.hasMoreElements()) {
+ Object nextElement = parameterNames.nextElement();
+ if (nextElement instanceof String) {
+ String paramName = (String)nextElement;
+ if (paramName.startsWith("privilege@")) {
+ String parameterValue = request.getParameter(paramName);
+ if (parameterValue != null && parameterValue.length() > 0) {
+ if ("granted".equals(parameterValue)) {
+ String privilegeName = paramName.substring(10);
+ grantedPrivilegeNames.add(privilegeName);
+ } else if ("denied".equals(parameterValue)) {
+ String privilegeName = paramName.substring(10);
+ deniedPrivilegeNames.add(privilegeName);
+ }
+ }
+ }
+ }
+ }
+
+ try {
+ AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(session);
+ AccessControlList updatedAcl = null;
+ AccessControlPolicyIterator applicablePolicies = accessControlManager.getApplicablePolicies(resourcePath);
+ while (applicablePolicies.hasNext()) {
+ AccessControlPolicy policy = applicablePolicies.nextAccessControlPolicy();
+ if (policy instanceof AccessControlList) {
+ updatedAcl = (AccessControlList)policy;
+ break;
+ }
+ }
+ if (updatedAcl == null) {
+ throw new RepositoryException("Unable to find an access conrol policy to update.");
+ }
+
+ StringBuilder oldPrivileges = null;
+ StringBuilder newPrivileges = null;
+ if (log.isDebugEnabled()) {
+ oldPrivileges = new StringBuilder();
+ newPrivileges = new StringBuilder();
+ }
+
+ //keep track of the existing Aces for the target principal
+ AccessControlEntry[] accessControlEntries = updatedAcl.getAccessControlEntries();
+ List<AccessControlEntry> oldAces = new ArrayList<AccessControlEntry>();
+ for (AccessControlEntry ace : accessControlEntries) {
+ if (principalId.equals(ace.getPrincipal().getName())) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found Existing ACE for principal {0} on resource: ", new Object[] {principalId, resourcePath});
+ }
+ oldAces.add(ace);
+
+ if (log.isDebugEnabled()) {
+ //collect the information for debug logging
+ boolean isAllow = AccessControlUtil.isAllow(ace);
+ Privilege[] privileges = ace.getPrivileges();
+ for (Privilege privilege : privileges) {
+ if (oldPrivileges.length() > 0) {
+ oldPrivileges.append(", "); //separate entries by commas
+ }
+ if (isAllow) {
+ oldPrivileges.append("granted=");
+ } else {
+ oldPrivileges.append("denied=");
+ }
+ oldPrivileges.append(privilege.getName());
+ }
+ }
+ }
+ }
+
+ //remove the old aces
+ if (!oldAces.isEmpty()) {
+ for (AccessControlEntry ace : oldAces) {
+ updatedAcl.removeAccessControlEntry(ace);
+ }
+ }
+
+ //add a fresh ACE with the granted privileges
+ List<Privilege> grantedPrivilegeList = new ArrayList<Privilege>();
+ for (String name : grantedPrivilegeNames) {
+ if (name.length() == 0) {
+ continue; //empty, skip it.
+ }
+ Privilege privilege = accessControlManager.privilegeFromName(name);
+ grantedPrivilegeList.add(privilege);
+
+ if (log.isDebugEnabled()) {
+ if (newPrivileges.length() > 0) {
+ newPrivileges.append(", "); //separate entries by commas
+ }
+ newPrivileges.append("granted=");
+ newPrivileges.append(privilege.getName());
+ }
+ }
+ if (grantedPrivilegeList.size() > 0) {
+ Principal principal = authorizable.getPrincipal();
+ updatedAcl.addAccessControlEntry(principal, grantedPrivilegeList.toArray(new Privilege[grantedPrivilegeList.size()]));
+ }
+
+ //if the authorizable is a user (not a group) process any denied privileges
+ if (!authorizable.isGroup()) {
+ //add a fresh ACE with the denied privileges
+ List<Privilege> deniedPrivilegeList = new ArrayList<Privilege>();
+ for (String name : deniedPrivilegeNames) {
+ if (name.length() == 0) {
+ continue; //empty, skip it.
+ }
+ Privilege privilege = accessControlManager.privilegeFromName(name);
+ deniedPrivilegeList.add(privilege);
+
+ if (log.isDebugEnabled()) {
+ if (newPrivileges.length() > 0) {
+ newPrivileges.append(", "); //separate entries by commas
+ }
+ newPrivileges.append("denied=");
+ newPrivileges.append(privilege.getName());
+ }
+ }
+ if (deniedPrivilegeList.size() > 0) {
+ Principal principal = authorizable.getPrincipal();
+ AccessControlUtil.addEntry(updatedAcl, principal, deniedPrivilegeList.toArray(new Privilege[deniedPrivilegeList.size()]), false);
+ }
+ }
+
+ accessControlManager.setPolicy(resourcePath, updatedAcl);
+ if (session.hasPendingChanges()) {
+ session.save();
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("Updated ACE for principalId {0} for resource {1) from {2} to {3}", new Object [] {
+ authorizable.getID(), resourcePath, oldPrivileges.toString(), newPrivileges.toString()
+ });
+ }
+ } catch (RepositoryException re) {
+ throw new RepositoryException("Failed to create ace.", re);
+ }
+ }
+}
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/java/org/apache/sling/jcr/jackrabbit/accessmanager/post/ModifyAceServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/resources/OSGI-INF/metatype/metatype.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/resources/org/apache/sling/jcr/jackrabbit/accessmanager/PrivilegesResources.properties
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/resources/org/apache/sling/jcr/jackrabbit/accessmanager/PrivilegesResources.properties?rev=768268&r1=768267&r2=768268&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/resources/org/apache/sling/jcr/jackrabbit/accessmanager/PrivilegesResources.properties (original)
+++ incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/resources/org/apache/sling/jcr/jackrabbit/accessmanager/PrivilegesResources.properties Fri Apr 24 12:14:03 2009
@@ -1,23 +1,23 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-privilegeset.all=Full Control
-privilegeset.readonly=Read Only
-privilegeset.readwrite=Read/Write
-privilegeset.none=None
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+privilegeset.all=Full Control
+privilegeset.readonly=Read Only
+privilegeset.readwrite=Read/Write
+privilegeset.none=None
privilegeset.custom=Custom
\ No newline at end of file
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-accessmanager/src/main/resources/org/apache/sling/jcr/jackrabbit/accessmanager/PrivilegesResources.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractAuthorizablePostServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractGroupPostServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/AbstractUserPostServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/ChangeUserPasswordServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateGroupServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/CreateUserServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/DeleteAuthorizableServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateGroupServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/jackrabbit-usermanager/src/main/java/org/apache/sling/jackrabbit/usermanager/post/UpdateUserServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/AbstractMappedObject.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/DefaultMappedObject.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/OcmConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/BundleMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ClassDescriptorReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ObjectContentManagerFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ObservingObjectCache.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/SlingAtomicTypeConverterProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ValueTypeConverterImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/BundleLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/ClassLoaderLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/Loader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/LoaderDelegate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/MapperClassLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceResolverFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverPlugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/LazyInputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/MapEntries.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/MapEntry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/Mapping.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/RedirectResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourcePathIterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderEntry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/main/resources/OSGI-INF/metatype/metatype.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/JcrPropertyMapTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2Test.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/ResourcePathIteratorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceTestBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/MockResourceResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingLocatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceLocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingSessionProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/webdav/src/main/resources/OSGI-INF/metatype/metatype.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/api/src/main/java/sun/misc/Service.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/ScriptEngineConsolePlugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/OnDemandReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/OnDemandReaderRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/OnDemandWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/OnDemandWriterResponse.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/SlingScriptEngineManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/RhinoHostObjectProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/helper/SlingContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/helper/SlingContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/bundles/scripting/javascript/src/main/java/org/apache/sling/scripting/javascript/helper/SlingGlobal.java
------------------------------------------------------------------------------
svn:eol-style = native