001package org.apache.fulcrum.security.model.basic.entity;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.Set;
023
024import org.apache.fulcrum.security.entity.Group;
025import org.apache.fulcrum.security.entity.User;
026import org.apache.fulcrum.security.util.GroupSet;
027
028/**
029 * Represents the "basic" model where users can be part of multiple groups
030 * directly, with no roles or permissions.
031 * 
032 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
033 * @version $Id$
034 */
035public interface BasicUser extends User
036{
037    /**
038     * Get the groups this user is part of
039     * 
040     * @return a set of groups
041     */
042    public GroupSet getGroups();
043
044    /**
045     * Set the groups this user is part of
046     * 
047     * @param groups
048     *            the set of groups
049     */
050    public void setGroups(GroupSet groups);
051
052    /**
053     * Remove the group from the list of groups
054     * 
055     * @param group
056     *            the group to remove
057     */
058    public void removeGroup(Group group);
059
060    /**
061     * Add the group to the list of groups
062     * 
063     * @param group
064     *            the group to add
065     */
066    public void addGroup(Group group);
067
068    /**
069     * Set the groups this user is part of as a Set
070     * 
071     * @param groups
072     *            the set of groups
073     */
074    public <T extends Group> void setGroupsAsSet(Set<T> groups);
075
076    /**
077     * Get the groups this user is part of as a Set
078     * 
079     * @return a set of groups
080     */
081    public <T extends Group> Set<T> getGroupsAsSet();
082}