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",
"[email protected]");
} 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.
--
View this message in context:
http://jackrabbit.510166.n4.nabble.com/Help-with-JCR-2-access-control-tp2403697p2403697.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.