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.core.query.sql.model.QueryBuilder;
030import org.nuxeo.ecm.platform.usermanager.GroupConfig;
031import org.nuxeo.ecm.platform.usermanager.NuxeoPrincipalImpl;
032
033/**
034 * Interface for computed group service.
035 *
036 * @author tiry
037 */
038public interface ComputedGroupsService {
039
040    boolean activateComputedGroups();
041
042    /**
043     * Returns list of ids for users computed groups.
044     */
045    List<String> computeGroupsForUser(NuxeoPrincipalImpl nuxeoPrincipal);
046
047    /**
048     * Update the virtual groups of the user with the computed groups.
049     */
050    void updateGroupsForUser(NuxeoPrincipalImpl nuxeoPrincipal);
051
052    /**
053     * Resolves a computed group by it's name.
054     * @deprecated since 9.3
055     */
056    @Deprecated
057    NuxeoGroup getComputedGroup(String groupName);
058
059    /**
060     * Resolves a computed group by it's name.
061     * @since 9.3
062     */
063    NuxeoGroup getComputedGroup(String groupName, GroupConfig groupConfig);
064
065    /**
066     * Defines if a computed group can override a physical group.
067     */
068    boolean allowGroupOverride();
069
070    /**
071     * Returns list of all computed groups (if this is available).
072     */
073    List<String> computeGroupIds();
074
075    /**
076     * Retrieves member users for a given computed group.
077     */
078    List<String> getComputedGroupMembers(String groupName);
079
080    /**
081     * Retrieves parent group for a given computed group.
082     */
083    List<String> getComputedGroupParent(String groupName);
084
085    /**
086     * Retrieves sub groups for a given computed group.
087     */
088    List<String> getComputedGroupSubGroups(String groupName);
089
090    /**
091     * Searches for a computed group.
092     */
093    List<String> searchComputedGroups(Map<String, Serializable> filter, Set<String> fulltext);
094
095    /**
096     * Searches for computed groups.
097     *
098     * @param queryBuilder the query
099     * @return the list of computed group ids
100     * @since 10.3
101     */
102    List<String> searchComputedGroups(QueryBuilder queryBuilder);
103
104}