001: /*
002: * Copyright 2002,2004 The Apache Software Foundation.
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:
017: package org.apache.catalina;
018:
019: import java.security.Principal;
020: import java.util.Iterator;
021:
022: /**
023: * <p>Abstract representation of a group of {@link User}s in a
024: * {@link UserDatabase}. Each user that is a member of this group
025: * inherits the {@link Role}s assigned to the group.</p>
026: *
027: * @author Craig R. McClanahan
028: * @version $Revision: 1.2 $ $Date: 2004/02/27 14:58:38 $
029: * @since 4.1
030: */
031:
032: public interface Group extends Principal {
033:
034: // ------------------------------------------------------------- Properties
035:
036: /**
037: * Return the description of this group.
038: */
039: public String getDescription();
040:
041: /**
042: * Set the description of this group.
043: *
044: * @param description The new description
045: */
046: public void setDescription(String description);
047:
048: /**
049: * Return the group name of this group, which must be unique
050: * within the scope of a {@link UserDatabase}.
051: */
052: public String getGroupname();
053:
054: /**
055: * Set the group name of this group, which must be unique
056: * within the scope of a {@link UserDatabase}.
057: *
058: * @param groupname The new group name
059: */
060: public void setGroupname(String groupname);
061:
062: /**
063: * Return the set of {@link Role}s assigned specifically to this group.
064: */
065: public Iterator getRoles();
066:
067: /**
068: * Return the {@link UserDatabase} within which this Group is defined.
069: */
070: public UserDatabase getUserDatabase();
071:
072: /**
073: * Return the set of {@link User}s that are members of this group.
074: */
075: public Iterator getUsers();
076:
077: // --------------------------------------------------------- Public Methods
078:
079: /**
080: * Add a new {@link Role} to those assigned specifically to this group.
081: *
082: * @param role The new role
083: */
084: public void addRole(Role role);
085:
086: /**
087: * Is this group specifically assigned the specified {@link Role}?
088: *
089: * @param role The role to check
090: */
091: public boolean isInRole(Role role);
092:
093: /**
094: * Remove a {@link Role} from those assigned to this group.
095: *
096: * @param role The old role
097: */
098: public void removeRole(Role role);
099:
100: /**
101: * Remove all {@link Role}s from those assigned to this group.
102: */
103: public void removeRoles();
104:
105: }
|