Jackrabbit User Management

I can not find documentation on how to create and create a repository for multiple users.

I'm new to Jackrabbit, and I always used one main user credential to create a repository that only one main user accessed.

Now I need a repository that is used by thousands of users, and each user works with his own sites and does not have access rights to others.

SimpleAccessManager is pretty simple:

public boolean isGranted(ItemId id, int permissions) throws RepositoryException {
    checkInitialized();
    if (system) {
        // system has always all permissions
        return true;
    } else if (anonymous) {
        // anonymous is always denied WRITE & REMOVE permissions
        if ((permissions & WRITE) == WRITE
                || (permissions & REMOVE) == REMOVE) {
            return false;
        }
    }

    return true;
}

It seems that you cannot create such a multi-user repository using SimpleLoginModule and SimpleAccessManager. Because it only distinguishes between ADMIN and anonymous users who can read everything but cannot write ...

So, you need to use the DefaultAccessManager and maybe do something like this:

Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray())); 

UserManager um = ((JackrabbitSession) session).getUserManager(); 
User user = um.createUser("john", "doe"); 

/*   And assign some ALC as follows... And then play with it like this, which really sucks without proper documentation, one has to reverse engineer everything, wtf */

AccessControlManager acm = session.getAccessControlManager();     
AccessControlPolicyIterator it = acm.getApplicablePolicies(testRootNode.getPath()); 
while ( it.hasNext() ) { 
    AccessControlPolicy acp = it.nextAccessControlPolicy(); 

    Privilege[] privileges = new Privilege[]{acm.privilegeFromName(Privilege.JCR_WRITE)}; 

    ((AccessControlList)acp).addAccessControlEntry(new PrincipalImpl(user.getUserID()), privileges); 

    acm.setPolicy(testRootNode.getPath(), acp); 
} 

OpenCMIS, .

EDIT: , AccessControl

+5
3

, , Hippo CMS, Apache JackRabbit. CMS , .

Hippo CMS .

+2

" ", JAAS, - (LDAP Database ..) . . : http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html, , .

, , SimpleAccessManager, AccessManager.

+2

All Articles