View Javadoc
1   package org.apache.fulcrum.security.model.basic;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.fulcrum.security.ModelManager;
23  import org.apache.fulcrum.security.entity.Group;
24  import org.apache.fulcrum.security.entity.User;
25  import org.apache.fulcrum.security.util.DataBackendException;
26  import org.apache.fulcrum.security.util.UnknownEntityException;
27  
28  /**
29   * Describes all the relationships between entities in the "Basic" model. This
30   * model pretty much allows a user to be in multiple groups. There is no concept
31   * of Permissions, Roles, Groups in Groups etc..
32   * 
33   * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
34   * @version $Id$
35   */
36  public interface BasicModelManager extends ModelManager
37  {
38      /**
39       * Puts a user in a group.
40       * 
41       * This method is used when adding a user to a group
42       * 
43       * @param user the User
44       * @param group the Group           
45       * @throws DataBackendException
46       *             if there was an error accessing the data backend.
47       * @throws UnknownEntityException
48       *             if the account is not present.
49       */
50      public void grant(User user, Group group) throws DataBackendException, UnknownEntityException;
51  
52      /**
53       * Removes a user from a group
54       * 
55       * @param user the User
56       * @param group the Group
57       * @throws DataBackendException
58       *             if there was an error accessing the data backend.
59       * @throws UnknownEntityException
60       *             if the user or group is not present.
61       */
62      public void revoke(User user, Group group) throws DataBackendException, UnknownEntityException;
63  
64      /**
65       * Revokes all groups from an User.
66       * 
67       * This method is used when deleting an account.
68       * 
69       * @param user
70       *            the User.
71       * @throws DataBackendException
72       *             if there was an error accessing the data backend.
73       * @throws UnknownEntityException
74       *             if the account is not present.
75       */
76      public void revokeAll(User user) throws DataBackendException, UnknownEntityException;
77  }