[
https://issues.apache.org/jira/browse/JCR-2339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
sydaiah nallabirudu updated JCR-2339:
-------------------------------------
Description:
We are facing issues while assigning the policies to a Node.
Let me give a brief explanation about project data structure.
We are string the data in repository with following structure
Root
MediaData
MediaObjects
We are assigning write policies to the MediaData node, if any user wants to
create
Media Objects.We could able to assign the policies with jackrabbit 1.5.4
version.
Recently we migrated to 1.6.0 version.
We are not able to assign the policies to MediaData node, but it is allowing to
assign the policies to the MediaObjects node.
Can you suggest us how to set the policies to the Node, which is under root by
using 1.6 version.
The application is not throwing any exception while setting the policies, but
the policies are not applying.
We are using following code to set policies:
Repository rep = new TransientRepository();
Credentials cr = new SimpleCredentials("admin", "admin".toCharArray());
String[] privilegeNames=new String[] { Privilege.JCR_ALL };
SessionImpl sess = (SessionImpl) rep.login(cr);
UserManager userManager = sess.getUserManager();
User user = (User) userManager.getAuthorizable(userData);
//System.out.println("the before creation user is" + user.getID());
if (user == null)
user = userManager.createUser(userData, userData);
System.out.println("the user is" + user.getID());
AccessControlManager accessControlManager = sess.getAccessControlManager();
AccessControlPolicyIterator policyItr =
accessControlManager.getApplicablePolicies("/MediaData");
JackrabbitAccessControlList accessPolicy = (JackrabbitAccessControlList)
policyItr.nextAccessControlPolicy();
Privilege[] previewPrivileges = new Privilege[privilegeNames.length];
int i = 0;
for (String privilegeName : privilegeNames) {
Privilege privilege =
accessControlManager.privilegeFromName(privilegeName);
previewPrivileges[i] = privilege;
i++;
}
// also possible to set a map of restrictions
accessPolicy.addEntry(user.getPrincipal(), previewPrivileges, true);
accessControlManager.setPolicy("/MediaData", accessPolicy);
Thanks
Sydaiah
was:
We are facing issues while assigning the policies to a Node.
Let me give a brief explanation about project data structure.
We are string the data in repository with following structure
Root
MediaData
MediaObjects
We are assigning write policies to the MediaData node, if any user wants to
create
Media Objects.We could able to assign the policies with jackrabbit 1.5.4
version.
Recently we migrated to 1.6.0 version.
We are not able to assign the policies to MediaData node, but it is allowing to
assign the policies to the MediaObjects node.
Can you suggest us how to set the policies to the Node, which is under root by
using 1.6 version.
The application is not throwing any exception while setting the policies, but
the policies are not applying.
We are using following code to set policies:
Repository rep = new TransientRepository();
Credentials cr = new SimpleCredentials("admin", "admin".toCharArray());
String[] privilegeNames=new String[] { Privilege.JCR_ALL };
SessionImpl sess = (SessionImpl) rep.login(cr);
UserManager userManager = sess.getUserManager();
User user = (User) userManager.getAuthorizable(userData);
//System.out.println("the before creation user is" + user.getID());
if (user == null)
user = userManager.createUser(userData, userData);
System.out.println("the user is" + user.getID());
AccessControlManager accessControlManager = sess.getAccessControlManager();
AccessControlPolicyIterator policyItr =
accessControlManager.getApplicablePolicies("/MediaData");
JackrabbitAccessControlList accessPolicy = (JackrabbitAccessControlList)
policyItr.nextAccessControlPolicy();
Privilege[] previewPrivileges = new Privilege[privilegeNames.length];
int i = 0;
for (String privilegeName : privilegeNames) {
Privilege privilege =
accessControlManager.privilegeFromName(privilegeName);
previewPrivileges[i] = privilege;
i++;
}
// also possible to set a map of restrictions
accessPolicy.addEntry(user.getPrincipal(), previewPrivileges, true);
accessControlManager.setPolicy("/MediaData", accessPolicy);
Thanks
Sydaiah
> Unable to set the policies to the node, which is under root by using 1.6
> version..
> ----------------------------------------------------------------------------------
>
> Key: JCR-2339
> URL: https://issues.apache.org/jira/browse/JCR-2339
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Reporter: sydaiah nallabirudu
>
> We are facing issues while assigning the policies to a Node.
> Let me give a brief explanation about project data structure.
> We are string the data in repository with following structure
> Root
> MediaData
> MediaObjects
> We are assigning write policies to the MediaData node, if any user wants to
> create
> Media Objects.We could able to assign the policies with jackrabbit 1.5.4
> version.
> Recently we migrated to 1.6.0 version.
> We are not able to assign the policies to MediaData node, but it is allowing
> to assign the policies to the MediaObjects node.
> Can you suggest us how to set the policies to the Node, which is under root
> by using 1.6 version.
> The application is not throwing any exception while setting the policies, but
> the policies are not applying.
> We are using following code to set policies:
> Repository rep = new TransientRepository();
> Credentials cr = new SimpleCredentials("admin", "admin".toCharArray());
> String[] privilegeNames=new String[] { Privilege.JCR_ALL };
> SessionImpl sess = (SessionImpl) rep.login(cr);
> UserManager userManager = sess.getUserManager();
> User user = (User) userManager.getAuthorizable(userData);
> //System.out.println("the before creation user is" + user.getID());
> if (user == null)
> user = userManager.createUser(userData, userData);
> System.out.println("the user is" + user.getID());
> AccessControlManager accessControlManager =
> sess.getAccessControlManager();
> AccessControlPolicyIterator policyItr =
> accessControlManager.getApplicablePolicies("/MediaData");
> JackrabbitAccessControlList accessPolicy = (JackrabbitAccessControlList)
> policyItr.nextAccessControlPolicy();
> Privilege[] previewPrivileges = new Privilege[privilegeNames.length];
> int i = 0;
> for (String privilegeName : privilegeNames) {
> Privilege privilege =
> accessControlManager.privilegeFromName(privilegeName);
> previewPrivileges[i] = privilege;
> i++;
> }
> // also possible to set a map of restrictions
> accessPolicy.addEntry(user.getPrincipal(), previewPrivileges, true);
> accessControlManager.setPolicy("/MediaData", accessPolicy);
> Thanks
> Sydaiah
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.