jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rohit mittal <rohit78...@gmail.com>
Subject Set the permission(read/write/all) on a node
Date Thu, 15 Oct 2009 06:46:06 GMT
Hi users,

I have a problem regarding to set the permission(read/write/all) on a node
for a user. In my user configuration ,I
place users in different directories on a single workspace.

The configuration for access manager in repository.xml is as follows:

  <AccessManager
class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
     <!--  <param name="config" value="${rep.home}/access.xml"/>       -->
  </AccessManager>

  To set the policy for a user("user1") , i am using following code-

AccessControlManager accessControlManager =
sessionImpl.getAccessControlManager();
String restrictedArea = folderNode.getPath();
AccessControlPolicy[] restrictedPolicies =
accessControlManager.getPolicies(restrictedArea);
JackrabbitAccessControlList restrictedPolicy =(JackrabbitAccessControlList)
restrictedPolicies.nextAccessControlPolicy();
Privilege[] privileges = {
accessControlManager.privilegeFromName(Privilege.JCR_READ) };
Principal p_myUser = new PrincipalImpl("user1");
restrictedPolicy.addEntry(p_myUser, privileges, true);
accessControlManager.setPolicy(restrictedArea, restrictedPolicy);
sessionImpl.save();

  Please tell me , How to set the permission on a node ?

Thanks
Rohit Mittal

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