Search in sources :

Example 11 with AccessManager

use of org.apache.jackrabbit.core.security.AccessManager in project jackrabbit by apache.

the class SimpleSecurityManager method getAccessManager.

/**
     * @see JackrabbitSecurityManager#getAccessManager(Session,AMContext)
     */
public AccessManager getAccessManager(Session session, AMContext amContext) throws RepositoryException {
    checkInitialized();
    try {
        String wspName = session.getWorkspace().getName();
        AccessControlProvider acP = getAccessControlProvider(systemSession, wspName);
        AccessManagerConfig amc = config.getAccessManagerConfig();
        AccessManager accessMgr;
        if (amc == null) {
            accessMgr = new SimpleAccessManager();
        } else {
            accessMgr = amc.newInstance(AccessManager.class);
        }
        accessMgr.init(amContext, acP, workspaceAccessManager);
        return accessMgr;
    } catch (AccessDeniedException ade) {
        // re-throw
        throw ade;
    } catch (Exception e) {
        // wrap in RepositoryException
        String msg = "failed to instantiate AccessManager implementation: " + SimpleAccessManager.class.getName();
        log.error(msg, e);
        throw new RepositoryException(msg, e);
    }
}
Also used : WorkspaceAccessManager(org.apache.jackrabbit.core.security.authorization.WorkspaceAccessManager) AccessManager(org.apache.jackrabbit.core.security.AccessManager) AccessDeniedException(javax.jcr.AccessDeniedException) AccessManagerConfig(org.apache.jackrabbit.core.config.AccessManagerConfig) AccessControlProvider(org.apache.jackrabbit.core.security.authorization.AccessControlProvider) RepositoryException(javax.jcr.RepositoryException) AccessDeniedException(javax.jcr.AccessDeniedException) RepositoryException(javax.jcr.RepositoryException) UnsupportedRepositoryOperationException(javax.jcr.UnsupportedRepositoryOperationException)

Aggregations

AccessManager (org.apache.jackrabbit.core.security.AccessManager)11 AccessDeniedException (javax.jcr.AccessDeniedException)9 RepositoryException (javax.jcr.RepositoryException)8 NodeState (org.apache.jackrabbit.core.state.NodeState)6 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)5 Path (org.apache.jackrabbit.spi.Path)5 ItemNotFoundException (javax.jcr.ItemNotFoundException)4 NodeId (org.apache.jackrabbit.core.id.NodeId)4 ItemExistsException (javax.jcr.ItemExistsException)3 PathNotFoundException (javax.jcr.PathNotFoundException)3 UnsupportedRepositoryOperationException (javax.jcr.UnsupportedRepositoryOperationException)3 EffectiveNodeType (org.apache.jackrabbit.core.nodetype.EffectiveNodeType)3 NodeTypeImpl (org.apache.jackrabbit.core.nodetype.NodeTypeImpl)3 RetentionRegistry (org.apache.jackrabbit.core.retention.RetentionRegistry)3 ChildNodeEntry (org.apache.jackrabbit.core.state.ChildNodeEntry)3 QItemDefinition (org.apache.jackrabbit.spi.QItemDefinition)3 AccessManagerConfig (org.apache.jackrabbit.core.config.AccessManagerConfig)2 AccessControlProvider (org.apache.jackrabbit.core.security.authorization.AccessControlProvider)2 WorkspaceAccessManager (org.apache.jackrabbit.core.security.authorization.WorkspaceAccessManager)2 ItemStateException (org.apache.jackrabbit.core.state.ItemStateException)2