001/*
002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     bjalon
018 */
019package org.nuxeo.ecm.platform.usermanager;
020
021import java.io.Serializable;
022import java.util.Map;
023import java.util.Set;
024
025import org.nuxeo.ecm.core.api.DocumentModel;
026
027/**
028 * Implementations of this interface manages the multi-tenant behavior for UserManager. This class will be used to fetch
029 * the User Directory and the Group characteristics
030 *
031 * @author bjalon
032 */
033public interface UserMultiTenantManagement {
034
035    /**
036     * Transform filter and fulltext to fetch Groups for the given context and the query specified with the given filter
037     * and fulltext. Be careful the filter map and the fulltext set object will be modified so copy them before.
038     */
039    void queryTransformer(UserManager um, Map<String, Serializable> filter, Set<String> fulltext, DocumentModel context);
040
041    /**
042     * Transform the Group DocumentModel store it into the tenant described by the context
043     *
044     * @param um
045     * @param group to modified
046     * @param context that bring the tenant information
047     */
048    DocumentModel groupTransformer(UserManager um, DocumentModel group, DocumentModel context);
049
050    /**
051     * Transform the GroupName to add to tenant characteristic.
052     *
053     * @param um
054     * @param group to modified
055     * @param context that bring the tenant information
056     */
057    String groupnameTranformer(UserManager um, String groupname, DocumentModel context);
058
059}