jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1455492 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java
Date Tue, 12 Mar 2013 11:12:13 GMT
Author: angela
Date: Tue Mar 12 11:12:13 2013
New Revision: 1455492

URL: http://svn.apache.org/r1455492
Log:
OAK-51 : Access Control Management (WIP, implement RepositoryStub#getKnownPrincipal)

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java?rev=1455492&r1=1455491&r2=1455492&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStubBase.java
Tue Mar 12 11:12:13 2013
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.oak.jcr;
 
 import java.security.Principal;
+import java.util.Iterator;
 import java.util.Properties;
 import java.util.concurrent.Executors;
 import javax.jcr.Credentials;
@@ -26,6 +27,8 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.test.RepositoryStub;
@@ -69,6 +72,13 @@ public class OakRepositoryStubBase exten
 
     @Override
     public Principal getKnownPrincipal(Session session) throws RepositoryException {
+        if (session instanceof JackrabbitSession) {
+            Iterator<Principal> principals = ((JackrabbitSession) session).getPrincipalManager().getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
+            if (principals.hasNext()) {
+                return principals.next();
+            }
+        }
+
         throw new UnsupportedRepositoryOperationException();
     }
 



Mime
View raw message