001/*
002 * (C) Copyright 2006-2007 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 *     Thierry Delprat
018 * *
019 */
020
021package org.nuxeo.ecm.platform.computedgroups;
022
023import java.io.Serializable;
024import java.util.List;
025import java.util.Map;
026import java.util.Set;
027
028import org.nuxeo.ecm.core.api.NuxeoGroup;
029import org.nuxeo.ecm.platform.usermanager.GroupConfig;
030import org.nuxeo.ecm.platform.usermanager.NuxeoPrincipalImpl;
031
032/**
033 * Interface for computed group service.
034 *
035 * @author tiry
036 */
037public interface ComputedGroupsService {
038
039    boolean activateComputedGroups();
040
041    /**
042     * Returns list of ids for users computed groups.
043     */
044    List<String> computeGroupsForUser(NuxeoPrincipalImpl nuxeoPrincipal);
045
046    /**
047     * Update the virtual groups of the user with the computed groups.
048     */
049    void updateGroupsForUser(NuxeoPrincipalImpl nuxeoPrincipal);
050
051    /**
052     * Resolves a computed group by it's name.
053     * @deprecated since 9.3
054     */
055    @Deprecated
056    NuxeoGroup getComputedGroup(String groupName);
057
058    /**
059     * Resolves a computed group by it's name.
060     * @since 9.3
061     */
062    NuxeoGroup getComputedGroup(String groupName, GroupConfig groupConfig);
063
064    /**
065     * Defines if a computed group can override a physical group.
066     */
067    boolean allowGroupOverride();
068
069    /**
070     * Returns list of all computed groups (if this is available).
071     */
072    List<String> computeGroupIds();
073
074    /**
075     * Retrieves member users for a given computed group.
076     */
077    List<String> getComputedGroupMembers(String groupName);
078
079    /**
080     * Retrieves parent group for a given computed group.
081     */
082    List<String> getComputedGroupParent(String groupName);
083
084    /**
085     * Retrieves sub groups for a given computed group.
086     */
087    List<String> getComputedGroupSubGroups(String groupName);
088
089    /**
090     * Searches for a computed group.
091     */
092    List<String> searchComputedGroups(Map<String, Serializable> filter, Set<String> fulltext);
093
094}