You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:48:32 UTC

[sling-org-apache-sling-jcr-jackrabbit-usermanager] 03/24: SLING-1379 Support adapt to User and Group

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.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-jackrabbit-usermanager.git

commit e9b4cac7a81a9c611798fd895fb275428c292c5e
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Tue Feb 16 10:46:40 2010 +0000

    SLING-1379  Support adapt to User and Group
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-usermanager@910461 13f79535-47bb-0310-9956-ffa450edef68
---
 .../jackrabbit/usermanager/impl/resource/AuthorizableResource.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableResource.java b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableResource.java
index 9d44008..56b4930 100644
--- a/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableResource.java
+++ b/src/main/java/org/apache/sling/jackrabbit/usermanager/impl/resource/AuthorizableResource.java
@@ -21,6 +21,8 @@ import java.util.Map;
 import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.Group;
+import org.apache.jackrabbit.api.security.user.User;
 import org.apache.sling.adapter.SlingAdaptable;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceMetadata;
@@ -107,7 +109,9 @@ public class AuthorizableResource extends SlingAdaptable implements Resource {
         if (type == Map.class || type == ValueMap.class) {
             return (AdapterType) new AuthorizableValueMap(authorizable); // unchecked
                                                                          // cast
-        } else if (type == Authorizable.class) {
+        } else if (type == Authorizable.class
+            || (type == User.class && !authorizable.isGroup())
+            || (type == Group.class && authorizable.isGroup())) {
             return (AdapterType) authorizable;
         }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.