This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.jcr.jackrabbit.usermanager-2.2.6 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-jackrabbit-usermanager.git
commit e2936708c82e91f64fd245b6fd81850033a79a96 Author: Carsten Ziegeler <[email protected]> AuthorDate: Wed Jan 11 13:43:46 2017 +0000 SLING-6451 : Remove dependency to jcr.resource API git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-usermanager@1778291 13f79535-47bb-0310-9956-ffa450edef68 --- LICENSE | 202 --------------------- NOTICE | 5 - pom.xml | 25 +-- .../impl/AuthorizablePrivilegesInfoImpl.java | 42 ++--- .../impl/post/AbstractAuthorizablePostServlet.java | 14 +- .../impl/post/AbstractUserPostServlet.java | 40 ---- .../impl/post/ChangeUserPasswordServlet.java | 74 +++----- .../usermanager/impl/post/CreateGroupServlet.java | 71 ++++---- .../usermanager/impl/post/CreateUserServlet.java | 118 +++++------- .../impl/post/DeleteAuthorizableServlet.java | 34 +--- .../usermanager/impl/post/UpdateGroupServlet.java | 71 ++++---- .../usermanager/impl/post/UpdateUserServlet.java | 58 +++--- .../resource/AuthorizableResourceProvider.java | 85 +++------ .../impl/resource/AuthorizableValueMap.java | 125 ++++++++++++- .../sling/jackrabbit/usermanager/package-info.java | 23 +++ src/main/resources/META-INF/LICENSE | 202 --------------------- src/main/resources/META-INF/NOTICE | 5 - .../OSGI-INF/metatype/metatype.properties | 58 ------ 18 files changed, 386 insertions(+), 866 deletions(-) diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 75b5248..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/NOTICE b/NOTICE deleted file mode 100644 index 65bcdb8..0000000 --- a/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Sling Jackrabbit UserManager Support -Copyright 2008-2010 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). diff --git a/pom.xml b/pom.xml index 178f738..c5cf16a 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.sling</groupId> <artifactId>sling</artifactId> - <version>26</version> + <version>29</version> <relativePath /> </parent> @@ -73,12 +73,6 @@ <extensions>true</extensions> <configuration> <instructions> - <Export-Package> - org.apache.sling.jackrabbit.usermanager;version=2.2.1, - </Export-Package> - <Private-Package> - org.apache.sling.jackrabbit.usermanager.impl.* - </Private-Package> <Embed-Dependency> org.apache.sling.servlets.post;inline="org/apache/sling/servlets/post/impl/helper/RequestProperty* |org/apache/sling/servlets/post/impl/helper/DateParser* @@ -93,12 +87,12 @@ <dependencies> <dependency> <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> + <artifactId>javax.servlet-api</artifactId> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.api</artifactId> - <version>2.2.0</version> + <version>2.11.0</version> <scope>provided</scope> </dependency> <dependency> @@ -125,16 +119,12 @@ </dependency> <dependency> <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> + <artifactId>osgi.core</artifactId> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.jcr.resource</artifactId> - <version>2.0.6</version> + <version>2.9.0</version> <scope>provided</scope> </dependency> <dependency> @@ -147,11 +137,6 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> - - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>adapter-annotations</artifactId> diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/AuthorizablePrivilegesInfoImpl.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/AuthorizablePrivilegesInfoImpl.java index ee76f1f..de78b48 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/AuthorizablePrivilegesInfoImpl.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/AuthorizablePrivilegesInfoImpl.java @@ -19,15 +19,13 @@ package org.apache.sling.jackrabbit.usermanager.impl; import java.io.UnsupportedEncodingException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; -import java.util.Dictionary; +import java.util.Collection; +import java.util.Map; import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.servlet.Servlet; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.User; import org.apache.jackrabbit.api.security.user.UserManager; @@ -37,7 +35,8 @@ import org.apache.sling.jcr.base.util.AccessControlUtil; import org.osgi.framework.BundleContext; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; -import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,8 +52,11 @@ import org.slf4j.LoggerFactory; * her/his group membership,</li> * </ul> */ -@Component (immediate=true) -@Service (value=AuthorizablePrivilegesInfo.class) +@Component(service=AuthorizablePrivilegesInfo.class, + property={ + AuthorizablePrivilegesInfoImpl.PAR_USER_ADMIN_GROUP_NAME + "=" + AuthorizablePrivilegesInfoImpl.DEFAULT_USER_ADMIN_GROUP_NAME, + AuthorizablePrivilegesInfoImpl.PAR_GROUP_ADMIN_GROUP_NAME + "=" + AuthorizablePrivilegesInfoImpl.DEFAULT_GROUP_ADMIN_GROUP_NAME + }) public class AuthorizablePrivilegesInfoImpl implements AuthorizablePrivilegesInfo { /** default log */ @@ -65,28 +67,26 @@ public class AuthorizablePrivilegesInfoImpl implements AuthorizablePrivilegesInf * * @see #PAR_USER_ADMIN_GROUP_NAME */ - private static final String DEFAULT_USER_ADMIN_GROUP_NAME = "UserAdmin"; + static final String DEFAULT_USER_ADMIN_GROUP_NAME = "UserAdmin"; /** * The name of the configuration parameter providing the * 'User administrator' group name. */ - @Property (value=DEFAULT_USER_ADMIN_GROUP_NAME) - private static final String PAR_USER_ADMIN_GROUP_NAME = "user.admin.group.name"; + static final String PAR_USER_ADMIN_GROUP_NAME = "user.admin.group.name"; /** * The default 'User administrator' group name * * @see #PAR_GROUP_ADMIN_GROUP_NAME */ - private static final String DEFAULT_GROUP_ADMIN_GROUP_NAME = "GroupAdmin"; + static final String DEFAULT_GROUP_ADMIN_GROUP_NAME = "GroupAdmin"; /** * The name of the configuration parameter providing the * 'Group administrator' group name. */ - @Property (value=DEFAULT_GROUP_ADMIN_GROUP_NAME) - private static final String PAR_GROUP_ADMIN_GROUP_NAME = "group.admin.group.name"; + static final String PAR_GROUP_ADMIN_GROUP_NAME = "group.admin.group.name"; /* (non-Javadoc) * @see org.apache.sling.jackrabbit.usermanager.AuthorizablePrivilegesInfo#canAddGroup(javax.jcr.Session) @@ -113,13 +113,12 @@ public class AuthorizablePrivilegesInfoImpl implements AuthorizablePrivilegesInf public boolean canAddUser(Session jcrSession) { try { //if self-registration is enabled, then anyone can create a user - if (componentContext != null) { + if (bundleContext != null) { String filter = "(&(sling.servlet.resourceTypes=sling/users)(|(sling.servlet.methods=POST)(sling.servlet.selectors=create)))"; - BundleContext bundleContext = componentContext.getBundleContext(); - ServiceReference[] serviceReferences = bundleContext.getServiceReferences(Servlet.class.getName(), filter); + Collection<ServiceReference<Servlet>> serviceReferences = bundleContext.getServiceReferences(Servlet.class, filter); if (serviceReferences != null) { String propName = "self.registration.enabled"; - for (ServiceReference serviceReference : serviceReferences) { + for (ServiceReference<Servlet> serviceReference : serviceReferences) { Object propValue = serviceReference.getProperty(propName); if (propValue != null) { boolean selfRegEnabled = Boolean.TRUE.equals(propValue); @@ -207,7 +206,7 @@ public class AuthorizablePrivilegesInfoImpl implements AuthorizablePrivilegesInf // ---------- SCR Integration ---------------------------------------------- //keep track of the bundle context - private ComponentContext componentContext; + private BundleContext bundleContext; /** * Called by SCR to activate the component. @@ -217,14 +216,13 @@ public class AuthorizablePrivilegesInfoImpl implements AuthorizablePrivilegesInf * @throws IllegalStateException * @throws UnsupportedEncodingException */ - protected void activate(ComponentContext componentContext) + @Activate + protected void activate(BundleContext bundleContext, Map<String, Object> properties) throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, UnsupportedEncodingException { - this.componentContext = componentContext; + this.bundleContext = bundleContext; - Dictionary<?, ?> properties = componentContext.getProperties(); - String userAdminGroupName = OsgiUtil.toString(properties.get(PAR_USER_ADMIN_GROUP_NAME), null); if ( userAdminGroupName != null && ! DEFAULT_USER_ADMIN_GROUP_NAME.equals(userAdminGroupName)) { log.warn("Configuration setting for {} is deprecated and will not have any effect", PAR_USER_ADMIN_GROUP_NAME); diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/AbstractAuthorizablePostServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/AbstractAuthorizablePostServlet.java index 14f546f..bbdc579 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/AbstractAuthorizablePostServlet.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/AbstractAuthorizablePostServlet.java @@ -20,7 +20,6 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.Calendar; -import java.util.Dictionary; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -42,7 +41,6 @@ import org.apache.sling.servlets.post.Modification; import org.apache.sling.servlets.post.SlingPostConstants; import org.apache.sling.servlets.post.impl.helper.DateParser; import org.apache.sling.servlets.post.impl.helper.RequestProperty; -import org.osgi.service.component.ComponentContext; /** * Base class for all the POST servlets for the UserManager operations @@ -57,9 +55,7 @@ public abstract class AbstractAuthorizablePostServlet extends // ---------- SCR Integration ---------------------------------------------- - protected void activate(ComponentContext context) { - Dictionary<?, ?> props = context.getProperties(); - + protected void activate(Map<String, Object> props) { dateParser = new DateParser(); String[] dateFormats = OsgiUtil.toStringArray(props.get(PROP_DATE_FORMAT)); for (String dateFormat : dateFormats) { @@ -67,7 +63,7 @@ public abstract class AbstractAuthorizablePostServlet extends } } - protected void deactivate(ComponentContext context) { + protected void deactivate() { dateParser = null; } @@ -671,6 +667,12 @@ public abstract class AbstractAuthorizablePostServlet extends } @Override + public String getName() { + // TODO Auto-generated method stub + return null; + } + + @Override public String toString() { return this.getString(); } diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/AbstractUserPostServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/AbstractUserPostServlet.java deleted file mode 100644 index 23ad715..0000000 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/AbstractUserPostServlet.java +++ /dev/null @@ -1,40 +0,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.jackrabbit.usermanager.impl.post; - -import org.osgi.service.component.ComponentContext; - -/** - * Base class for servlets manipulating users - */ -public abstract class AbstractUserPostServlet extends - AbstractAuthorizablePostServlet { - - private static final long serialVersionUID = 8292047684552692610L; - - // ---------- SCR Integration ---------------------------------------------- - - @Override - protected void activate(ComponentContext context) { - super.activate(context); - } - - @Override - protected void deactivate(ComponentContext context) { - super.deactivate(context); - } -} diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/ChangeUserPasswordServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/ChangeUserPasswordServlet.java index eb1181f..3e24888 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/ChangeUserPasswordServlet.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/ChangeUserPasswordServlet.java @@ -16,20 +16,13 @@ */ package org.apache.sling.jackrabbit.usermanager.impl.post; -import java.lang.reflect.Method; -import java.util.Dictionary; import java.util.List; +import java.util.Map; -import javax.jcr.Credentials; import javax.jcr.RepositoryException; import javax.jcr.Session; -import javax.jcr.SimpleCredentials; import javax.servlet.Servlet; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Properties; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.Group; import org.apache.jackrabbit.api.security.user.User; @@ -43,7 +36,9 @@ import org.apache.sling.jackrabbit.usermanager.impl.resource.AuthorizableResourc import org.apache.sling.jcr.base.util.AccessControlUtil; import org.apache.sling.servlets.post.AbstractPostResponse; import org.apache.sling.servlets.post.Modification; -import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -84,31 +79,21 @@ import org.slf4j.LoggerFactory; * * <h4>Notes</h4> */ -@Component (metatype=true, - label="%changeUserPassword.post.operation.name", - description="%changeUserPassword.post.operation.description") -@Service (value={ - Servlet.class, - ChangeUserPassword.class -}) -@Properties ({ - @Property (name="sling.servlet.resourceTypes", - value="sling/user"), - @Property (name="sling.servlet.methods", - value="POST"), - @Property (name="sling.servlet.selectors", - value="changePassword"), - @Property (name=AbstractAuthorizablePostServlet.PROP_DATE_FORMAT, - value={ - "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", - "yyyy-MM-dd'T'HH:mm:ss.SSSZ", - "yyyy-MM-dd'T'HH:mm:ss", - "yyyy-MM-dd", - "dd.MM.yyyy HH:mm:ss", - "dd.MM.yyyy" - }) -}) -public class ChangeUserPasswordServlet extends AbstractUserPostServlet implements ChangeUserPassword { + +@Component(service = {Servlet.class, ChangeUserPassword.class}, + property = { + "sling.servlet.resourceTypes=sling/user", + "sling.servlet.methods=POST", + "sling.servlet.selectors=changePassword", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=EEE MMM dd yyyy HH:mm:ss 'GMT'Z", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss.SSSZ", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy", + ChangeUserPasswordServlet.PAR_USER_ADMIN_GROUP_NAME + "=" + ChangeUserPasswordServlet.DEFAULT_USER_ADMIN_GROUP_NAME + }) +public class ChangeUserPasswordServlet extends AbstractAuthorizablePostServlet implements ChangeUserPassword { private static final long serialVersionUID = 1923614318474654502L; /** @@ -121,15 +106,14 @@ public class ChangeUserPasswordServlet extends AbstractUserPostServlet implement * * @see #PAR_USER_ADMIN_GROUP_NAME */ - private static final String DEFAULT_USER_ADMIN_GROUP_NAME = "UserAdmin"; + static final String DEFAULT_USER_ADMIN_GROUP_NAME = "UserAdmin"; /** * The name of the configuration parameter providing the * name of the group whose members are allowed to reset the password * of a user without the 'oldPwd' value. */ - @Property (value=DEFAULT_USER_ADMIN_GROUP_NAME) - private static final String PAR_USER_ADMIN_GROUP_NAME = "user.admin.group.name"; + static final String PAR_USER_ADMIN_GROUP_NAME = "user.admin.group.name"; private String userAdminGroupName = DEFAULT_USER_ADMIN_GROUP_NAME; @@ -138,22 +122,22 @@ public class ChangeUserPasswordServlet extends AbstractUserPostServlet implement /** * Activates this component. * - * @param componentContext The OSGi <code>ComponentContext</code> of this - * component. + * @param props The component properties */ @Override - protected void activate(ComponentContext componentContext) { - super.activate(componentContext); - Dictionary<?, ?> props = componentContext.getProperties(); + @Activate + protected void activate(final Map<String, Object> props) { + super.activate(props); this.userAdminGroupName = OsgiUtil.toString(props.get(PAR_USER_ADMIN_GROUP_NAME), DEFAULT_USER_ADMIN_GROUP_NAME); - log.info("User Admin Group Name {}", this.userAdminGroupName); + log.debug("User Admin Group Name {}", this.userAdminGroupName); } @Override - protected void deactivate(ComponentContext context) { - super.deactivate(context); + @Deactivate + protected void deactivate() { + super.deactivate(); } /* diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateGroupServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateGroupServlet.java index cb9334d..d0e26a7 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateGroupServlet.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateGroupServlet.java @@ -17,6 +17,7 @@ package org.apache.sling.jackrabbit.usermanager.impl.post; import java.security.Principal; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -24,26 +25,25 @@ import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.servlet.Servlet; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Properties; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.Group; import org.apache.jackrabbit.api.security.user.UserManager; import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; -import org.apache.sling.api.servlets.HtmlResponse; +import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.jackrabbit.usermanager.CreateGroup; import org.apache.sling.jackrabbit.usermanager.impl.resource.AuthorizableResourceProvider; import org.apache.sling.jcr.base.util.AccessControlUtil; -import org.apache.sling.jcr.resource.JcrResourceResolverFactory; import org.apache.sling.servlets.post.AbstractPostResponse; import org.apache.sling.servlets.post.Modification; import org.apache.sling.servlets.post.SlingPostConstants; import org.apache.sling.servlets.post.impl.helper.RequestProperty; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; /** * <p> @@ -83,36 +83,37 @@ import org.apache.sling.servlets.post.impl.helper.RequestProperty; * * <h4>Notes</h4> */ -@Component (immediate=true, metatype=true, - label="%createGroup.post.operation.name", - description="%createGroup.post.operation.description") -@Service (value={ - Servlet.class, - CreateGroup.class -}) -@Properties ({ - @Property (name="sling.servlet.resourceTypes", - value="sling/groups"), - @Property (name="sling.servlet.methods", - value="POST"), - @Property (name="sling.servlet.selectors", - value="create"), - @Property (name=AbstractAuthorizablePostServlet.PROP_DATE_FORMAT, - value={ - "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", - "yyyy-MM-dd'T'HH:mm:ss.SSSZ", - "yyyy-MM-dd'T'HH:mm:ss", - "yyyy-MM-dd", - "dd.MM.yyyy HH:mm:ss", - "dd.MM.yyyy" - }) + +@Component(service = {Servlet.class, CreateGroup.class}, +property = { + "sling.servlet.resourceTypes=sling/groups", + "sling.servlet.methods=POST", + "sling.servlet.selectors=create", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=EEE MMM dd yyyy HH:mm:ss 'GMT'Z", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss.SSSZ", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy" }) public class CreateGroupServlet extends AbstractGroupPostServlet implements CreateGroup { private static final long serialVersionUID = -1084915263933901466L; @Reference - private JcrResourceResolverFactory resourceResolverFactory; + private ResourceResolverFactory resourceResolverFactory; + @Override + @Activate + protected void activate(final Map<String, Object> props) { + super.activate(props); + } + + @Override + @Deactivate + protected void deactivate() { + super.deactivate(); + } + /* * (non-Javadoc) * @see @@ -186,10 +187,14 @@ public class CreateGroupServlet extends AbstractGroupPostServlet implements Crea ResourceResolver resourceResolver = null; try { //create a resource resolver to resolve the relative paths used for group membership values - resourceResolver = resourceResolverFactory.getResourceResolver(jcrSession); + final Map<String, Object> authInfo = new HashMap<String, Object>(); + authInfo.put(org.apache.sling.jcr.resource.api.JcrResourceConstants.AUTHENTICATION_INFO_SESSION, jcrSession); + resourceResolver = resourceResolverFactory.getResourceResolver(authInfo); Resource baseResource = resourceResolver.getResource(AuthorizableResourceProvider.SYSTEM_USER_MANAGER_GROUP_PATH); updateGroupMembership(baseResource, properties, group, changes); - } finally { + } catch (LoginException e) { + throw new RepositoryException(e); + } finally { if (resourceResolver != null) { resourceResolver.close(); } diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java index 5c6232d..4992055 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/CreateUserServlet.java @@ -16,7 +16,6 @@ */ package org.apache.sling.jackrabbit.usermanager.impl.post; -import java.util.Dictionary; import java.util.List; import java.util.Map; @@ -24,11 +23,6 @@ import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.servlet.Servlet; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Properties; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.Group; import org.apache.jackrabbit.api.security.user.User; @@ -44,7 +38,13 @@ import org.apache.sling.servlets.post.Modification; import org.apache.sling.servlets.post.ModificationType; import org.apache.sling.servlets.post.SlingPostConstants; import org.apache.sling.servlets.post.impl.helper.RequestProperty; -import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.Designate; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -87,62 +87,40 @@ import org.slf4j.LoggerFactory; * curl -F:name=ieb -Fpwd=password -FpwdConfirm=password -Fproperty1=value1 http://localhost:8080/system/userManager/user.create.html * </code> */ -@Component (metatype=true, - label="%createUser.post.operation.name", - description="%createUser.post.operation.description") -@Service(value={ - Servlet.class, - CreateUser.class +@Designate(ocd = CreateUserServlet.Config.class) +@Component(service = {Servlet.class, CreateUser.class}, + property = { + "sling.servlet.resourceTypes=sling/users", + "sling.servlet.methods=POST", + "sling.servlet.selectors=create", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=EEE MMM dd yyyy HH:mm:ss 'GMT'Z", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss.SSSZ", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy", + ChangeUserPasswordServlet.PAR_USER_ADMIN_GROUP_NAME + "=" + ChangeUserPasswordServlet.DEFAULT_USER_ADMIN_GROUP_NAME }) -@Properties ({ - @Property (name="sling.servlet.resourceTypes", - value="sling/users"), - @Property (name="sling.servlet.methods", - value="POST"), - @Property (name="sling.servlet.selectors", - value="create"), - @Property (name=AbstractAuthorizablePostServlet.PROP_DATE_FORMAT, - value={ - "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", - "yyyy-MM-dd'T'HH:mm:ss.SSSZ", - "yyyy-MM-dd'T'HH:mm:ss", - "yyyy-MM-dd", - "dd.MM.yyyy HH:mm:ss", - "dd.MM.yyyy" - }) -}) -public class CreateUserServlet extends AbstractUserPostServlet implements CreateUser { +public class CreateUserServlet extends AbstractAuthorizablePostServlet implements CreateUser { private static final long serialVersionUID = 6871481922737658675L; + @ObjectClassDefinition(name = "Apache Sling Create User", + description = "The Sling operation to handle create user requests in Sling.") + public @interface Config { + + @AttributeDefinition(name = "Self-Registration Enabled", + description = "When selected, the anonymous user is allowed to register a new user with the system.") + boolean self_registration_enabled() default false; + } + /** * default log */ private final Logger log = LoggerFactory.getLogger(getClass()); - private static final boolean DEFAULT_SELF_REGISTRATION_ENABLED = false; - - @Property (label="%self.registration.enabled.name", - description="%self.registration.enabled.description", - boolValue=DEFAULT_SELF_REGISTRATION_ENABLED) - private static final String PROP_SELF_REGISTRATION_ENABLED = "self.registration.enabled"; - - private Boolean selfRegistrationEnabled = DEFAULT_SELF_REGISTRATION_ENABLED; - - /** - * The default 'User administrator' group name - * - * @see #PAR_USER_ADMIN_GROUP_NAME - */ - private static final String DEFAULT_USER_ADMIN_GROUP_NAME = "UserAdmin"; - - /** - * The name of the configuration parameter providing the - * 'User administrator' group name. - */ - @Property (value=DEFAULT_USER_ADMIN_GROUP_NAME) - private static final String PAR_USER_ADMIN_GROUP_NAME = "user.admin.group.name"; + private boolean selfRegistrationEnabled; - private String userAdminGroupName = DEFAULT_USER_ADMIN_GROUP_NAME; + private String userAdminGroupName = ChangeUserPasswordServlet.DEFAULT_USER_ADMIN_GROUP_NAME; /** * The JCR Repository we access to resolve resources @@ -175,30 +153,22 @@ public class CreateUserServlet extends AbstractUserPostServlet implements Create /** * Activates this component. * - * @param componentContext The OSGi <code>ComponentContext</code> of this - * component. + * @param props The configuration properties */ - @Override - protected void activate(ComponentContext componentContext) { - super.activate(componentContext); - Dictionary<?, ?> props = componentContext.getProperties(); - Object propValue = props.get(PROP_SELF_REGISTRATION_ENABLED); - if (propValue instanceof Boolean) { - selfRegistrationEnabled = (Boolean)propValue; - } else if (propValue instanceof String) { - selfRegistrationEnabled = Boolean.parseBoolean((String) propValue); - } else { - selfRegistrationEnabled = DEFAULT_SELF_REGISTRATION_ENABLED; - } - - this.userAdminGroupName = OsgiUtil.toString(props.get(PAR_USER_ADMIN_GROUP_NAME), - DEFAULT_USER_ADMIN_GROUP_NAME); - log.info("User Admin Group Name {}", this.userAdminGroupName); + @Activate + protected void activate(Config config, Map<String, Object> props) { + super.activate(props); + selfRegistrationEnabled = config.self_registration_enabled(); + + this.userAdminGroupName = OsgiUtil.toString(props.get(ChangeUserPasswordServlet.PAR_USER_ADMIN_GROUP_NAME), + ChangeUserPasswordServlet.DEFAULT_USER_ADMIN_GROUP_NAME); + log.debug("User Admin Group Name {}", this.userAdminGroupName); } @Override - protected void deactivate(ComponentContext context) { - super.deactivate(context); + @Deactivate + protected void deactivate() { + super.deactivate(); } /* diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/DeleteAuthorizableServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/DeleteAuthorizableServlet.java index 5d6637c..b893610 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/DeleteAuthorizableServlet.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/DeleteAuthorizableServlet.java @@ -25,10 +25,6 @@ import javax.jcr.Session; import javax.servlet.Servlet; import javax.servlet.http.HttpServletResponse; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Properties; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.Group; import org.apache.jackrabbit.api.security.user.User; @@ -37,7 +33,6 @@ 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.resource.ResourceResolver; -import org.apache.sling.api.servlets.HtmlResponse; import org.apache.sling.jackrabbit.usermanager.DeleteAuthorizables; import org.apache.sling.jackrabbit.usermanager.DeleteGroup; import org.apache.sling.jackrabbit.usermanager.DeleteUser; @@ -46,6 +41,7 @@ import org.apache.sling.jcr.base.util.AccessControlUtil; import org.apache.sling.servlets.post.AbstractPostResponse; import org.apache.sling.servlets.post.Modification; import org.apache.sling.servlets.post.SlingPostConstants; +import org.osgi.service.component.annotations.Component; /** @@ -81,26 +77,14 @@ import org.apache.sling.servlets.post.SlingPostConstants; * curl -Fgo=1 http://localhost:8080/system/userManager/user/ieb.delete.html * </code> */ -@Component (immediate=true, metatype=true, - label="%deleteAuthorizable.post.operation.name", - description="%deleteAuthorizable.post.operation.description") -@Service (value={ - Servlet.class, - DeleteUser.class, - DeleteGroup.class, - DeleteAuthorizables.class -}) -@Properties ({ - @Property (name="sling.servlet.resourceTypes", - value={ - "sling/user", - "sling/group", - "sling/userManager" - }), - @Property (name="sling.servlet.methods", - value="POST"), - @Property (name="sling.servlet.selectors", - value="delete") + +@Component(service = {Servlet.class, DeleteUser.class, DeleteGroup.class, DeleteAuthorizables.class}, + property = { + "sling.servlet.resourceTypes=sling/user", + "sling.servlet.resourceTypes=sling/group", + "sling.servlet.resourceTypes=sling/userManager", + "sling.servlet.methods=POST", + "sling.servlet.selectors=delete" }) public class DeleteAuthorizableServlet extends AbstractPostServlet implements DeleteUser, DeleteGroup, DeleteAuthorizables { diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateGroupServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateGroupServlet.java index 41c7bbf..0a8df63 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateGroupServlet.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateGroupServlet.java @@ -16,6 +16,7 @@ */ package org.apache.sling.jackrabbit.usermanager.impl.post; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -23,26 +24,25 @@ import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.servlet.Servlet; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Properties; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.Group; import org.apache.jackrabbit.api.security.user.UserManager; import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceNotFoundException; import org.apache.sling.api.resource.ResourceResolver; -import org.apache.sling.api.servlets.HtmlResponse; +import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.jackrabbit.usermanager.UpdateGroup; import org.apache.sling.jackrabbit.usermanager.impl.resource.AuthorizableResourceProvider; import org.apache.sling.jcr.base.util.AccessControlUtil; -import org.apache.sling.jcr.resource.JcrResourceResolverFactory; import org.apache.sling.servlets.post.AbstractPostResponse; import org.apache.sling.servlets.post.Modification; import org.apache.sling.servlets.post.impl.helper.RequestProperty; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; /** * <p> @@ -83,37 +83,38 @@ import org.apache.sling.servlets.post.impl.helper.RequestProperty; * curl -Fprop1=value2 -Fproperty1=value1 http://localhost:8080/system/userManager/group/testGroup.update.html * </code> */ -@Component (immediate=true, metatype=true, - label="%updateGroup.post.operation.name", - description="%updateGroup.post.operation.description") -@Service (value={ - Servlet.class, - UpdateGroup.class -}) -@Properties ({ - @Property (name="sling.servlet.resourceTypes", - value="sling/group"), - @Property (name="sling.servlet.methods", - value="POST"), - @Property (name="sling.servlet.selectors", - value="update"), - @Property (name=AbstractAuthorizablePostServlet.PROP_DATE_FORMAT, - value={ - "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", - "yyyy-MM-dd'T'HH:mm:ss.SSSZ", - "yyyy-MM-dd'T'HH:mm:ss", - "yyyy-MM-dd", - "dd.MM.yyyy HH:mm:ss", - "dd.MM.yyyy" - }) + +@Component(service = {Servlet.class, UpdateGroup.class}, +property = { + "sling.servlet.resourceTypes=sling/group", + "sling.servlet.methods=POST", + "sling.servlet.selectors=update", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=EEE MMM dd yyyy HH:mm:ss 'GMT'Z", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss.SSSZ", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy" }) public class UpdateGroupServlet extends AbstractGroupPostServlet implements UpdateGroup { private static final long serialVersionUID = -8292054361992488797L; @Reference - private JcrResourceResolverFactory resourceResolverFactory; + private ResourceResolverFactory resourceResolverFactory; + @Override + @Activate + protected void activate(final Map<String, Object> props) { + super.activate(props); + } + + @Override + @Deactivate + protected void deactivate() { + super.deactivate(); + } + /* * (non-Javadoc) * @see @@ -167,10 +168,14 @@ public class UpdateGroupServlet extends AbstractGroupPostServlet ResourceResolver resourceResolver = null; try { //create a resource resolver to resolve the relative paths used for group membership values - resourceResolver = resourceResolverFactory.getResourceResolver(jcrSession); + final Map<String, Object> authInfo = new HashMap<String, Object>(); + authInfo.put(org.apache.sling.jcr.resource.api.JcrResourceConstants.AUTHENTICATION_INFO_SESSION, jcrSession); + resourceResolver = resourceResolverFactory.getResourceResolver(authInfo); Resource baseResource = resourceResolver.getResource(groupPath); updateGroupMembership(baseResource, properties, group, changes); - } finally { + } catch (LoginException e) { + throw new RepositoryException(e); + } finally { if (resourceResolver != null) { resourceResolver.close(); } diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateUserServlet.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateUserServlet.java index c61b40d..aa11544 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateUserServlet.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateUserServlet.java @@ -23,10 +23,6 @@ import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.servlet.Servlet; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Properties; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.User; import org.apache.jackrabbit.api.security.user.UserManager; @@ -39,7 +35,9 @@ import org.apache.sling.jcr.base.util.AccessControlUtil; import org.apache.sling.servlets.post.AbstractPostResponse; import org.apache.sling.servlets.post.Modification; import org.apache.sling.servlets.post.impl.helper.RequestProperty; -import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; /** * <p> @@ -79,42 +77,34 @@ import org.osgi.service.component.ComponentContext; * curl -Fprop1=value2 -Fproperty1=value1 http://localhost:8080/system/userManager/user/ieb.update.html * </code> */ -@Component (metatype=true, - label="%updateUser.post.operation.name", - description="%updateUser.post.operation.description") -@Service (value={ - Servlet.class, - UpdateUser.class -}) -@Properties ({ - @Property (name="sling.servlet.resourceTypes", - value="sling/user"), - @Property (name="sling.servlet.methods", - value="POST"), - @Property (name="sling.servlet.selectors", - value="update"), - @Property (name=AbstractAuthorizablePostServlet.PROP_DATE_FORMAT, - value={ - "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", - "yyyy-MM-dd'T'HH:mm:ss.SSSZ", - "yyyy-MM-dd'T'HH:mm:ss", - "yyyy-MM-dd", - "dd.MM.yyyy HH:mm:ss", - "dd.MM.yyyy" - }) + +@Component(service = {Servlet.class, UpdateUser.class}, +property = { + "sling.servlet.resourceTypes=sling/user", + "sling.servlet.methods=POST", + "sling.servlet.selectors=update", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=EEE MMM dd yyyy HH:mm:ss 'GMT'Z", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss.SSSZ", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd'T'HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=yyyy-MM-dd", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy HH:mm:ss", + AbstractAuthorizablePostServlet.PROP_DATE_FORMAT + "=dd.MM.yyyy" }) -public class UpdateUserServlet extends AbstractUserPostServlet +public class UpdateUserServlet extends AbstractAuthorizablePostServlet implements UpdateUser { - private static final long serialVersionUID = 5874621724096106496L; + + private static final long serialVersionUID = 5874621724096106496L; @Override - protected void activate(ComponentContext context) { - super.activate(context); + @Activate + protected void activate(final Map<String, Object> props) { + super.activate(props); } @Override - protected void deactivate(ComponentContext context) { - super.deactivate(context); + @Deactivate + protected void deactivate( ) { + super.deactivate(); } /* diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableResourceProvider.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableResourceProvider.java index cfe86b9..ce42ed1 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableResourceProvider.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableResourceProvider.java @@ -23,41 +23,33 @@ import java.util.List; import javax.jcr.RepositoryException; import javax.jcr.Session; -import javax.servlet.http.HttpServletRequest; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Properties; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Service; import org.apache.jackrabbit.api.security.principal.PrincipalIterator; import org.apache.jackrabbit.api.security.principal.PrincipalManager; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.UserManager; import org.apache.sling.api.SlingException; import org.apache.sling.api.resource.Resource; -import org.apache.sling.api.resource.ResourceProvider; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.SyntheticResource; import org.apache.sling.jcr.base.util.AccessControlUtil; +import org.apache.sling.spi.resource.provider.ResolveContext; +import org.apache.sling.spi.resource.provider.ResourceContext; +import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.osgi.service.component.annotations.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Resource Provider implementation for jackrabbit UserManager resources. */ -@Component (immediate=true, metatype=true, - label="%authorizable.resourceprovider.name", - description="%authorizable.resourceprovider.description") -@Service (value=ResourceProvider.class) -@Properties ({ - @Property (name="service.description", - value="Resource provider implementation for UserManager resources"), - @Property (name="service.vendor", - value="The Apache Software Foundation"), - @Property (name="provider.roots", - value="/system/userManager/") -}) -public class AuthorizableResourceProvider implements ResourceProvider { +@Component(service = ResourceProvider.class, + property={ + "service.description=Resource provider implementation for UserManager resources", + "service.vendor=The Apache Software Foundation", + ResourceProvider.PROPERTY_ROOT + "=" + AuthorizableResourceProvider.SYSTEM_USER_MANAGER_PATH + }) +public class AuthorizableResourceProvider extends ResourceProvider<Object> { /** * default log @@ -78,34 +70,21 @@ public class AuthorizableResourceProvider implements ResourceProvider { public static final String SYSTEM_USER_MANAGER_GROUP_PREFIX = SYSTEM_USER_MANAGER_GROUP_PATH + "/"; - /* - * (non-Javadoc) - * @see - * org.apache.sling.api.resource.ResourceProvider#getResource(org.apache - * .sling.api.resource.ResourceResolver, - * javax.servlet.http.HttpServletRequest, java.lang.String) - */ - public Resource getResource(ResourceResolver resourceResolver, - HttpServletRequest request, String path) { - return getResource(resourceResolver, path); - } - - /* - * (non-Javadoc) - * @see - * org.apache.sling.api.resource.ResourceProvider#getResource(org.apache - * .sling.api.resource.ResourceResolver, java.lang.String) - */ - public Resource getResource(ResourceResolver resourceResolver, String path) { + + @Override + public Resource getResource(ResolveContext<Object> ctx, + String path, + ResourceContext resourceContext, + Resource parent) { // handle resources for the virtual container resources if (path.equals(SYSTEM_USER_MANAGER_PATH)) { - return new SyntheticResource(resourceResolver, path, + return new SyntheticResource(ctx.getResourceResolver(), path, "sling/userManager"); } else if (path.equals(SYSTEM_USER_MANAGER_USER_PATH)) { - return new SyntheticResource(resourceResolver, path, "sling/users"); + return new SyntheticResource(ctx.getResourceResolver(), path, "sling/users"); } else if (path.equals(SYSTEM_USER_MANAGER_GROUP_PATH)) { - return new SyntheticResource(resourceResolver, path, "sling/groups"); + return new SyntheticResource(ctx.getResourceResolver(), path, "sling/groups"); } // the principalId should be the first segment after the prefix @@ -122,7 +101,7 @@ public class AuthorizableResourceProvider implements ResourceProvider { // out now. } try { - Session session = resourceResolver.adaptTo(Session.class); + Session session = ctx.getResourceResolver().adaptTo(Session.class); if (session != null) { UserManager userManager = AccessControlUtil.getUserManager(session); if (userManager != null) { @@ -131,7 +110,7 @@ public class AuthorizableResourceProvider implements ResourceProvider { // found the Authorizable, so return the resource // that wraps it. return new AuthorizableResource(authorizable, - resourceResolver, path); + ctx.getResourceResolver(), path); } } } @@ -143,16 +122,8 @@ public class AuthorizableResourceProvider implements ResourceProvider { return null; } - /* - * (non-Javadoc) - * @see - * org.apache.sling.api.resource.ResourceProvider#listChildren(org.apache - * .sling.api.resource.Resource) - */ - public Iterator<Resource> listChildren(Resource parent) { - if (parent == null) { - throw new NullPointerException("parent is null"); - } + @Override + public Iterator<Resource> listChildren(ResolveContext<Object> ctx, Resource parent) { try { String path = parent.getPath(); ResourceResolver resourceResolver = parent.getResourceResolver(); @@ -161,10 +132,10 @@ public class AuthorizableResourceProvider implements ResourceProvider { if (SYSTEM_USER_MANAGER_PATH.equals(path)) { List<Resource> resources = new ArrayList<Resource>(); if (resourceResolver != null) { - resources.add(getResource(resourceResolver, - SYSTEM_USER_MANAGER_USER_PATH)); - resources.add(getResource(resourceResolver, - SYSTEM_USER_MANAGER_GROUP_PATH)); + resources.add(getResource(ctx, + SYSTEM_USER_MANAGER_USER_PATH, null, null)); + resources.add(getResource(ctx, + SYSTEM_USER_MANAGER_GROUP_PATH, null, null)); } return resources.iterator(); } diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableValueMap.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableValueMap.java index 1a31ca3..c1f650e 100644 --- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableValueMap.java +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableValueMap.java @@ -16,6 +16,8 @@ */ package org.apache.sling.jackrabbit.usermanager.impl.resource; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Calendar; @@ -28,6 +30,7 @@ import java.util.Map; import java.util.Set; import javax.jcr.Property; +import javax.jcr.PropertyType; import javax.jcr.RepositoryException; import javax.jcr.Value; import javax.jcr.ValueFormatException; @@ -35,7 +38,6 @@ import javax.jcr.ValueFormatException; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.api.security.user.Group; import org.apache.sling.api.resource.ValueMap; -import org.apache.sling.jcr.resource.JcrResourceUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -170,22 +172,51 @@ public class AuthorizableValueMap implements ValueMap { return null; } + /** + * Converts a JCR Value to a corresponding Java Object + * + * @param value the JCR Value to convert + * @return the Java Object + * @throws RepositoryException if the value cannot be converted + */ + public static Object toJavaObject(Value value) throws RepositoryException { + switch (value.getType()) { + case PropertyType.DECIMAL: + return value.getDecimal(); + case PropertyType.BINARY: + return new LazyInputStream(value); + case PropertyType.BOOLEAN: + return value.getBoolean(); + case PropertyType.DATE: + return value.getDate(); + case PropertyType.DOUBLE: + return value.getDouble(); + case PropertyType.LONG: + return value.getLong(); + case PropertyType.NAME: // fall through + case PropertyType.PATH: // fall through + case PropertyType.REFERENCE: // fall through + case PropertyType.STRING: // fall through + case PropertyType.UNDEFINED: // not actually expected + default: // not actually expected + return value.getString(); + } + } protected Object valuesToJavaObject(Value[] values) throws RepositoryException { if (values == null) { return null; } else if (values.length == 1) { - return JcrResourceUtil.toJavaObject(values[0]); + return toJavaObject(values[0]); } else { Object[] valuesObjs = new Object[values.length]; for (int i = 0; i < values.length; i++) { - valuesObjs[i] = JcrResourceUtil.toJavaObject(values[i]); + valuesObjs[i] = toJavaObject(values[i]); } return valuesObjs; } } - @SuppressWarnings("unchecked") protected void readFully() { if (!fullyRead) { try { @@ -196,7 +227,7 @@ public class AuthorizableValueMap implements ValueMap { cache.put(MEMBER_OF_KEY, getMemberships(authorizable, true)); cache.put(DECLARED_MEMBER_OF_KEY, getMemberships(authorizable, false)); - Iterator pi = authorizable.getPropertyNames(); + Iterator<String> pi = authorizable.getPropertyNames(); while (pi.hasNext()) { String key = (String) pi.next(); if (!cache.containsKey(key)) { @@ -371,5 +402,89 @@ public class AuthorizableValueMap implements ValueMap { } return results.toArray(new String[results.size()]); } + + public static class LazyInputStream extends InputStream { + /** The JCR Value from which the input stream is requested on demand */ + private final Value value; + + /** The inputstream created on demand, null if not used */ + private InputStream delegatee; + + public LazyInputStream(Value value) { + this.value = value; + } + + /** + * Closes the input stream if acquired otherwise does nothing. + */ + @Override + public void close() throws IOException { + if (delegatee != null) { + delegatee.close(); + } + } + + @Override + public int available() throws IOException { + return getStream().available(); + } + + @Override + public int read() throws IOException { + return getStream().read(); + } + + @Override + public int read(byte[] b) throws IOException { + return getStream().read(b); + } + + @Override + public int read(byte[] b, int off, int len) throws IOException { + return getStream().read(b, off, len); + } + + @Override + public long skip(long n) throws IOException { + return getStream().skip(n); + } + + @Override + public boolean markSupported() { + try { + return getStream().markSupported(); + } catch (IOException ioe) { + // ignore + } + return false; + } + + @Override + public synchronized void mark(int readlimit) { + try { + getStream().mark(readlimit); + } catch (IOException ioe) { + // ignore + } + } + + @Override + public synchronized void reset() throws IOException { + getStream().reset(); + } + + /** Actually retrieves the input stream from the underlying JCR Value */ + private InputStream getStream() throws IOException { + if (delegatee == null) { + try { + delegatee = value.getBinary().getStream(); + } catch (RepositoryException re) { + throw (IOException) new IOException(re.getMessage()).initCause(re); + } + } + return delegatee; + } + + } } \ No newline at end of file diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/package-info.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/package-info.java new file mode 100644 index 0000000..02521b0 --- /dev/null +++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/package-info.java @@ -0,0 +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. + */ + [email protected]("2.2.1") +package org.apache.sling.jackrabbit.usermanager; + + diff --git a/src/main/resources/META-INF/LICENSE b/src/main/resources/META-INF/LICENSE deleted file mode 100644 index 75b5248..0000000 --- a/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 65bcdb8..0000000 --- a/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Sling Jackrabbit UserManager Support -Copyright 2008-2010 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties deleted file mode 100644 index 177a3f7..0000000 --- a/src/main/resources/OSGI-INF/metatype/metatype.properties +++ /dev/null @@ -1,58 +0,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. -# - - -# -# This file contains localization strings for configuration labels and -# descriptions as used in the metatype.xml descriptor generated by the -# the Sling SCR plugin - -authorizable.resourceprovider.name = Apache Sling Resolver for UserManager resources -authorizable.resourceprovider.description = Handles resolving resources for the \ - jackrabbit UserManager. - -createUser.post.operation.name = Apache Sling Create User -createUser.post.operation.description = The Sling operation to handle create user \ - requests in Sling. - -self.registration.enabled.name = Self-Registration Enabled -self.registration.enabled.description = When selected, the anonymous user is allowed to \ - register a new user with the system. - - -changeUserPassword.post.operation.name = Apache Sling Change User Password -changeUserPassword.post.operation.description = The Sling operation to handle change user \ - password requests in Sling. - -createGroup.post.operation.name = Apache Sling Create Group -createGroup.post.operation.description = The Sling operation to handle create group \ - requests in Sling. - -updateUser.post.operation.name = Apache Sling Update User -updateUser.post.operation.description = The Sling operation to handle update user \ - requests in Sling. - -updateGroup.post.operation.name = Apache Sling Update Group -updateGroup.post.operation.description = The Sling operation to handle update group \ - requests in Sling. - -deleteAuthorizable.post.operation.name = Apache Sling Delete User/Group -deleteAuthorizable.post.operation.description = The Sling operation to handle delete user \ - or group requests in Sling. - \ No newline at end of file -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
