View Javadoc

1   package org.apache.turbine.om.security;
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 java.io.Serializable;
23  
24  import org.apache.turbine.util.security.RoleSet;
25  import org.apache.turbine.util.security.TurbineSecurityException;
26  
27  /***
28   * This class represents a Group of Users in the system that are associated
29   * with specific entity or resource. The users belonging to the Group may have
30   * various Roles. The Permissions to perform actions upon the resource depend
31   * on the Roles in the Group that they are assigned.
32   *
33   * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
34   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
35   * @version $Id: Group.java 534527 2007-05-02 16:10:59Z tv $
36   */
37  public interface Group extends SecurityEntity, Serializable
38  {
39      /***
40       * The name of the <a href="#global">global group</a>
41       */
42      String GLOBAL_GROUP_NAME = "global";
43  
44      /***
45       * Makes changes made to the Group attributes permanent.
46       *
47       * @throws TurbineSecurityException if there is a problem while
48       *  saving data.
49       */
50      void save()
51          throws TurbineSecurityException;
52  
53      /***
54       * Removes a group from the system.
55       *
56       * @throws TurbineSecurityException if the Group could not be removed.
57       */
58      void remove()
59          throws TurbineSecurityException;
60  
61      /***
62       * Renames the role.
63       *
64       * @param name The new Group name.
65       * @throws TurbineSecurityException if the Group could not be renamed.
66       */
67      void rename(String name)
68          throws TurbineSecurityException;
69  
70      /***
71       * Grants a Role in this Group to an User.
72       *
73       * @param user An User.
74       * @param role A Role.
75       * @throws TurbineSecurityException if there is a problem while assigning
76       * the Role.
77       */
78      void grant(User user, Role role)
79          throws TurbineSecurityException;
80  
81      /***
82       * Grants Roles in this Group to an User.
83       *
84       * @param user An User.
85       * @param roleSet A RoleSet.
86       * @throws TurbineSecurityException if there is a problem while assigning
87       * the Roles.
88       */
89      void grant(User user, RoleSet roleSet)
90          throws TurbineSecurityException;
91  
92      /***
93       * Revokes a Role in this Group from an User.
94       *
95       * @param user An User.
96       * @param role A Role.
97       * @throws TurbineSecurityException if there is a problem while unassigning
98       * the Role.
99       */
100     void revoke(User user, Role role)
101         throws TurbineSecurityException;
102 
103     /***
104      * Revokes Roles in this group from an User.
105      *
106      * @param user An User.
107      * @param roleSet a RoleSet.
108      * @throws TurbineSecurityException if there is a problem while unassigning
109      * the Roles.
110      */
111     void revoke(User user, RoleSet roleSet)
112         throws TurbineSecurityException;
113 
114 }