001package org.apache.fulcrum.security.model.basic;
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 org.apache.fulcrum.security.ModelManager;
023import org.apache.fulcrum.security.entity.Group;
024import org.apache.fulcrum.security.entity.User;
025import org.apache.fulcrum.security.util.DataBackendException;
026import org.apache.fulcrum.security.util.UnknownEntityException;
027
028/**
029 * Describes all the relationships between entities in the "Basic" model. This
030 * model pretty much allows a user to be in multiple groups. There is no concept
031 * of Permissions, Roles, Groups in Groups etc..
032 * 
033 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
034 * @version $Id$
035 */
036public interface BasicModelManager extends ModelManager
037{
038    /**
039     * Puts a user in a group.
040     * 
041     * This method is used when adding a user to a group
042     * 
043     * @param user the User
044     * @param group the Group           
045     * @throws DataBackendException
046     *             if there was an error accessing the data backend.
047     * @throws UnknownEntityException
048     *             if the account is not present.
049     */
050    public void grant(User user, Group group) throws DataBackendException, UnknownEntityException;
051
052    /**
053     * Removes a user from a group
054     * 
055     * @param user the User
056     * @param group the Group
057     * @throws DataBackendException
058     *             if there was an error accessing the data backend.
059     * @throws UnknownEntityException
060     *             if the user or group is not present.
061     */
062    public void revoke(User user, Group group) throws DataBackendException, UnknownEntityException;
063
064    /**
065     * Revokes all groups from an User.
066     * 
067     * This method is used when deleting an account.
068     * 
069     * @param user
070     *            the User.
071     * @throws DataBackendException
072     *             if there was an error accessing the data backend.
073     * @throws UnknownEntityException
074     *             if the account is not present.
075     */
076    public void revokeAll(User user) throws DataBackendException, UnknownEntityException;
077}