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.platform.usermanager.NuxeoPrincipalImpl;
029
030/**
031 * Interface that must be implemented by all contributed {@link GroupComputer}s.
032 *
033 * @author Thierry Delprat
034 */
035public interface GroupComputer {
036
037    /**
038     * Returns the group names for a give User.
039     */
040    List<String> getGroupsForUser(NuxeoPrincipalImpl nuxeoPrincipal);
041
042    /**
043     * Return all group ids. If you class can not efficiently compute this list, you can return an empty list. In this
044     * case you need to implement the searchGroups method.
045     */
046    List<String> getAllGroupIds();
047
048    /**
049     * Returns the members for a give group.
050     */
051    List<String> getGroupMembers(String groupName);
052
053    /**
054     * Return parent groups.
055     */
056    List<String> getParentsGroupNames(String groupName);
057
058    /**
059     * Returns children groups.
060     */
061    List<String> getSubGroupsNames(String groupName);
062
063    /**
064     * Searches for a group. (This method is used in particular from UI to search/select a group).
065     */
066    List<String> searchGroups(Map<String, Serializable> filter, Set<String> fulltext);
067
068    /**
069     * Returns true if the given group exists.
070     */
071    boolean hasGroup(String name);
072
073}