jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From W Wilson <wowils...@hotmail.com>
Subject Workspace access denied exception
Date Tue, 01 Jun 2010 15:16:41 GMT

Apologises in advance if this has already been covered but i have searched
extensively to try to solve my current problem. 

I have just started using Jackrabbit and JCR2.0. Following some of the
simple examples referred to in this forum i wanted to set up a simple ACL
example. Login as admin, create a node, create a user, enable that user to
add to the admins node.

I have modified the repository xml file to include the
DefaultSecurityManager. DefaultAccessManager and the DefaultLoginModule:

<Security appName="Jackrabbit">    	
  <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager"
workspaceName ="security"/>   
class="org.apache.jackrabbit.core.security.DefaultAccessManager" />

Here are some snippets of the code im trying:

InitialContext initialContext = new InitialContext(env);
RegistryHelper.registerRepository(initialContext, "repo", configFile,
repHomeDir, true);
repository = (Repository)initialContext.lookup("repo");
SimpleCredentials credentials = new SimpleCredentials("admin",
session = repository.login(credentials);
Node root = session.getRootNode();
root.addNode("test node");
UserManager um = ((JackrabbitSession)session).getUserManager();
String userName = "jon";
String pwd = "doe";
User user = (User)um.getAuthorizable(userName);
if(user == null)
	user = um.createUser("jon", "doe");
Node testNode = root.getNode("test node");
System.out.println("Test node");
// Assign ACL to user w.r.t testNode
AccessControlManager acm = session.getAccessControlManager();
AccessControlPolicyIterator it =
	AccessControlPolicy acp = it.nextAccessControlPolicy();
	Privilege[] privileges = new
PrincipalImpl(user.getID()), privileges);
	acm.setPolicy(testNode.getPath(), acp);

System.out.println("\nRepository after permissions change");
userSession = repository.login(user.getCredentials()); ***
Node anonRoot = userSession.getRootNode();
System.out.println("\nRepository contents from jon doe");            
// Output after delete
Utils.removeAllNodesWithName("test node", session);
System.out.println("\nRepository contents post delete");

Unfortunately the code is failing at ***

javax.jcr.LoginException: Workspace access denied.

>From printouts of the actual node it appears that the user has been added to
the ACL for test node but not to the workspace?

Apologises if i have missed something obvious but any help would be much

Thanks in advance


View this message in context: http://jackrabbit.510166.n4.nabble.com/Workspace-access-denied-exception-tp2238686p2238686.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

View raw message