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