jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Atif Manzoor <atif.manz...@gmail.com>
Subject Access control
Date Mon, 24 Aug 2015 17:07:08 GMT
I am new to Jackrabbit and after going through the first hops and little
bit of documentation, I was trying to configure Access Control for the
repository nodes. I was extending ThirdHop tutorial for that purpose and
was following access control wiki
http://wiki.apache.org/jackrabbit/AccessControl and had the following code.

Session session = repository.login(new SimpleCredentials("username",
"password"
.toCharArray()));
Node node = session.getRootNode();
String path = node.getPath();
AccessControlManager acm = session.getAccessControlManager();

Privilege[] privileges = new Privilege[] { acm
.privilegeFromName(Privilege.JCR_ALL) };
AccessControlList acl;
try {
acl = (AccessControlList) acm.getApplicablePolicies(path)
.nextAccessControlPolicy();
} catch (NoSuchElementException e) {
acl = (AccessControlList) acm.getPolicies(path)[0];
}
for (AccessControlEntry e : acl.getAccessControlEntries()) {
acl.removeAccessControlEntry(e);
}
acl.addAccessControlEntry(EveryonePrincipal.getInstance(), privileges);
acm.setPolicy(path, acl);
session.save();

My problem is that I could not get AccessControlList with this code. Both
functions (getApplicablePolicies and getAllPolicies) don't have any
AccessControlList attached with them. Can you tell me where I went wrong. I
have been using the default security configuration.

Thanks
Atif

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message