I am trying to create a workspace programatically in an existing repository.
It seems that this point is not described by documentation, so I experimented the following:
Credentials credentials = new SimpleCredentials("admin", "admin".toCharArray()); Repository repository = getRepository("repository" ); Session session = repository.login(credentials, "default"); session.getWorkspace().createWorkspace("myWorkspace");
The last line throws unexpectingly the following exception:
javax.jcr.AccessDeniedException: java.security.AccessControlException: Permission denied to perform actions "create_workspace" on path <unknown>
If I check the Session object, it seems that it uses admin as a user. And, according to documentation, admin user is granted create_workspace role.
Any idea ?
another related question: The documentation deals with setting permission on repository or on a workspace, using the following Modeshape custom syntax:
from what I experiencied here is the working syntax, assuming the role is user1:
Where store is the repositorySourceName (probably the store name). Putting the repository name, in my case, I use the defaut repository named "repository" does not seem to work.
Is it the expected behavior or maybe I get something wrong ?