View Javadoc

1   package org.apache.turbine.om.security;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.apache.turbine.util.security.RoleSet;
20  import org.apache.turbine.util.security.TurbineSecurityException;
21  
22  /***
23   * This class represents a Group of Users in the system that are associated
24   * with specific entity or resource. The users belonging to the Group may have
25   * various Roles. The Permissions to perform actions upon the resource depend
26   * on the Roles in the Group that they are assigned.
27   *
28   * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
29   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
30   * @version $Id: Group.java 264148 2005-08-29 14:21:04Z henning $
31   */
32  public interface Group extends SecurityEntity
33  {
34      /***
35       * The name of the <a href="#global">global group</a>
36       */
37      String GLOBAL_GROUP_NAME = "global";
38  
39      /***
40       * Makes changes made to the Group attributes permanent.
41       *
42       * @throws TurbineSecurityException if there is a problem while
43       *  saving data.
44       */
45      void save()
46          throws TurbineSecurityException;
47  
48      /***
49       * Removes a group from the system.
50       *
51       * @throws TurbineSecurityException if the Group could not be removed.
52       */
53      void remove()
54          throws TurbineSecurityException;
55  
56      /***
57       * Renames the role.
58       *
59       * @param name The new Group name.
60       * @throws TurbineSecurityException if the Group could not be renamed.
61       */
62      void rename(String name)
63          throws TurbineSecurityException;
64  
65      /***
66       * Grants a Role in this Group to an User.
67       *
68       * @param user An User.
69       * @param role A Role.
70       * @throws TurbineSecurityException if there is a problem while assigning
71       * the Role.
72       */
73      void grant(User user, Role role)
74          throws TurbineSecurityException;
75  
76      /***
77       * Grants Roles in this Group to an User.
78       *
79       * @param user An User.
80       * @param roleSet A RoleSet.
81       * @throws TurbineSecurityException if there is a problem while assigning
82       * the Roles.
83       */
84      void grant(User user, RoleSet roleSet)
85          throws TurbineSecurityException;
86  
87      /***
88       * Revokes a Role in this Group from an User.
89       *
90       * @param user An User.
91       * @param role A Role.
92       * @throws TurbineSecurityException if there is a problem while unassigning
93       * the Role.
94       */
95      void revoke(User user, Role role)
96          throws TurbineSecurityException;
97  
98      /***
99       * Revokes Roles in this group from an User.
100      *
101      * @param user An User.
102      * @param roleSet a RoleSet.
103      * @throws TurbineSecurityException if there is a problem while unassigning
104      * the Roles.
105      */
106     void revoke(User user, RoleSet roleSet)
107         throws TurbineSecurityException;
108 
109 }