1 /* 2 * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.security.acl; 27 28 import java.util.Enumeration; 29 import java.security.Principal; 30 31 /** 32 * This interface is used to represent a group of principals. (A principal 33 * represents an entity such as an individual user or a company). <p> 34 * 35 * Note that Group extends Principal. Thus, either a Principal or a Group can 36 * be passed as an argument to methods containing a Principal parameter. For 37 * example, you can add either a Principal or a Group to a Group object by 38 * calling the object's {@code addMember} method, passing it the 39 * Principal or Group. 40 * 41 * @author Satish Dharmaraj 42 * @since 1.1 43 * 44 * @deprecated This class is deprecated and subject to removal in a future 45 * version of Java SE. It has been replaced by {@code java.security.Policy} 46 * and related classes since 1.2. 47 */ 48 @Deprecated(since="9", forRemoval=true) 49 public interface Group extends Principal { 50 51 /** 52 * Adds the specified member to the group. 53 * 54 * @param user the principal to add to this group. 55 * 56 * @return true if the member was successfully added, 57 * false if the principal was already a member. 58 */ addMember(Principal user)59 public boolean addMember(Principal user); 60 61 /** 62 * Removes the specified member from the group. 63 * 64 * @param user the principal to remove from this group. 65 * 66 * @return true if the principal was removed, or 67 * false if the principal was not a member. 68 */ removeMember(Principal user)69 public boolean removeMember(Principal user); 70 71 /** 72 * Returns true if the passed principal is a member of the group. 73 * This method does a recursive search, so if a principal belongs to a 74 * group which is a member of this group, true is returned. 75 * 76 * @param member the principal whose membership is to be checked. 77 * 78 * @return true if the principal is a member of this group, 79 * false otherwise. 80 */ isMember(Principal member)81 public boolean isMember(Principal member); 82 83 84 /** 85 * Returns an enumeration of the members in the group. 86 * The returned objects can be instances of either Principal 87 * or Group (which is a subclass of Principal). 88 * 89 * @return an enumeration of the group members. 90 */ members()91 public Enumeration<? extends Principal> members(); 92 93 } 94