Search in sources :

Example 1 with ACLProvider

use of org.apache.jackrabbit.core.security.authorization.acl.ACLProvider in project jackrabbit by apache.

the class AccessControlProviderFactoryImpl method createProvider.

/**
     * @see AccessControlProviderFactory#createProvider(Session, WorkspaceSecurityConfig)
     */
public AccessControlProvider createProvider(Session systemSession, WorkspaceSecurityConfig config) throws RepositoryException {
    String workspaceName = systemSession.getWorkspace().getName();
    AccessControlProvider prov;
    Map props;
    if (config != null && config.getAccessControlProviderConfig() != null) {
        BeanConfig bc = config.getAccessControlProviderConfig();
        prov = bc.newInstance(AccessControlProvider.class);
        props = bc.getParameters();
    } else {
        log.debug("No ac-provider configuration for workspace " + workspaceName + " -> using defaults.");
        if (workspaceName.equals(secWorkspaceName) && !workspaceName.equals(defaultWorkspaceName)) {
            // UserAccessControlProvider is designed to work with an extra
            // workspace storing user and groups. therefore avoid returning
            // this ac provider for the default workspace.
            prov = new UserAccessControlProvider();
        } else {
            prov = new ACLProvider();
        }
        log.debug("Default provider for workspace " + workspaceName + " = " + prov.getClass().getName());
        props = Collections.emptyMap();
    }
    prov.init(systemSession, props);
    return prov;
}
Also used : BeanConfig(org.apache.jackrabbit.core.config.BeanConfig) UserAccessControlProvider(org.apache.jackrabbit.core.security.user.UserAccessControlProvider) ACLProvider(org.apache.jackrabbit.core.security.authorization.acl.ACLProvider) UserAccessControlProvider(org.apache.jackrabbit.core.security.user.UserAccessControlProvider) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 BeanConfig (org.apache.jackrabbit.core.config.BeanConfig)1 ACLProvider (org.apache.jackrabbit.core.security.authorization.acl.ACLProvider)1 UserAccessControlProvider (org.apache.jackrabbit.core.security.user.UserAccessControlProvider)1