jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Edelson <justinedel...@gmail.com>
Subject Re: Help with JCR 2 access control
Date Wed, 01 Sep 2010 19:13:30 GMT
You should use DefaultAccessManager. I also suspect you want to use
getEffectivePolicies() or getPolicies() instead of
getApplicablePolicies(), but that's up to you.

Justin

On 9/1/10 2:25 PM, aimran wrote:
> 
> It seems, there is very sparse information about one of the key features
> [access control] of Jackrabbit 2. I started with the expectation that
> setting policies should be easy, but after browsing through the lists and
> documentation, I am still pounding my head.
> 
> So, I use start a repository and want to set access control on a node so
> that some users can view it and some cannot. 
> 
> My repository.xml has the security configuration:
> <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager"
> workspaceName="default">
>         </SecurityManager>
> 
>         <AccessManager
> class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
>         </AccessManager>
> 
>         <LoginModule
> class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
>             
>             
>         </LoginModule>
> 
> The code that tests the access control capability:
> Session session = null;
>         try {
>             session = Main.getInstance().getSession("admin",
> "admin","default");//get session to the default workspace
>             Node n = session.getRootNode().addNode("base");
>             session.save();
>           print(session.getRootNode());
>            
> System.out.println("ACL:"+session.getAccessControlManager().getApplicablePolicies(session.getRootNode().getPath()).getSize());
>             //RepoUtil.print(session.getRootNode());
>             //Main.getInstance().createWorkSpace(session, "community1",
> "user1@test.com");
>         } catch (Exception ex) {
>             // ex.printStackTrace();
>             System.out.println("EXPN1:" + ex);
>         }
> 
> The getApplicablePolicies return 0. So how do I set access control on  the
> node?
> 
> The printing of the root node looks like this:
> [/(jcr:primaryType = rep:root)]
> [/jcr:system
> [/base(jcr:primaryType = nt:unstructured)]
> 
> I must surely be missing something very obvious.


Mime
View raw message