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
26package java.security.acl;
27
28import java.util.Enumeration;
29import 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 package has been replaced by {@code java.security.Policy}
45 *      and related classes since 1.2.
46 */
47@Deprecated(since="9")
48public interface Group extends Principal {
49
50    /**
51     * Adds the specified member to the group.
52     *
53     * @param user the principal to add to this group.
54     *
55     * @return true if the member was successfully added,
56     * false if the principal was already a member.
57     */
58    public boolean addMember(Principal user);
59
60    /**
61     * Removes the specified member from the group.
62     *
63     * @param user the principal to remove from this group.
64     *
65     * @return true if the principal was removed, or
66     * false if the principal was not a member.
67     */
68    public boolean removeMember(Principal user);
69
70    /**
71     * Returns true if the passed principal is a member of the group.
72     * This method does a recursive search, so if a principal belongs to a
73     * group which is a member of this group, true is returned.
74     *
75     * @param member the principal whose membership is to be checked.
76     *
77     * @return true if the principal is a member of this group,
78     * false otherwise.
79     */
80    public boolean isMember(Principal member);
81
82
83    /**
84     * Returns an enumeration of the members in the group.
85     * The returned objects can be instances of either Principal
86     * or Group (which is a subclass of Principal).
87     *
88     * @return an enumeration of the group members.
89     */
90    public Enumeration<? extends Principal> members();
91
92}
93