001/*
002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     bjalon
016 */
017package org.nuxeo.ecm.platform.usermanager;
018
019import java.io.Serializable;
020import java.util.Map;
021import java.util.Set;
022
023import org.nuxeo.ecm.core.api.DocumentModel;
024
025/**
026 * Implementations of this interface manages the multi-tenant behavior for UserManager. This class will be used to fetch
027 * the User Directory and the Group characteristics
028 *
029 * @author bjalon
030 */
031public interface UserMultiTenantManagement {
032
033    /**
034     * Transform filter and fulltext to fetch Groups for the given context and the query specified with the given filter
035     * and fulltext. Be careful the filter map and the fulltext set object will be modified so copy them before.
036     */
037    void queryTransformer(UserManager um, Map<String, Serializable> filter, Set<String> fulltext, DocumentModel context);
038
039    /**
040     * Transform the Group DocumentModel store it into the tenant described by the context
041     *
042     * @param um
043     * @param group to modified
044     * @param context that bring the tenant information
045     */
046    DocumentModel groupTransformer(UserManager um, DocumentModel group, DocumentModel context);
047
048    /**
049     * Transform the GroupName to add to tenant characteristic.
050     *
051     * @param um
052     * @param group to modified
053     * @param context that bring the tenant information
054     */
055    String groupnameTranformer(UserManager um, String groupname, DocumentModel context);
056
057}