View Javadoc

1   package org.apache.turbine.om.security;
2   
3   /* ====================================================================
4    * The Apache Software License, Version 1.1
5    *
6    * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
7    * reserved.
8    *
9    * Redistribution and use in source and binary forms, with or without
10   * modification, are permitted provided that the following conditions
11   * are met:
12   *
13   * 1. Redistributions of source code must retain the above copyright
14   *    notice, this list of conditions and the following disclaimer.
15   *
16   * 2. Redistributions in binary form must reproduce the above copyright
17   *    notice, this list of conditions and the following disclaimer in
18   *    the documentation and/or other materials provided with the
19   *    distribution.
20   *
21   * 3. The end-user documentation included with the redistribution,
22   *    if any, must include the following acknowledgment:
23   *       "This product includes software developed by the
24   *        Apache Software Foundation (http://www.apache.org/)."
25   *    Alternately, this acknowledgment may appear in the software itself,
26   *    if and wherever such third-party acknowledgments normally appear.
27   *
28   * 4. The names "Apache" and "Apache Software Foundation" and
29   *    "Apache Turbine" must not be used to endorse or promote products
30   *    derived from this software without prior written permission. For
31   *    written permission, please contact apache@apache.org.
32   *
33   * 5. Products derived from this software may not be called "Apache",
34   *    "Apache Turbine", nor may "Apache" appear in their name, without
35   *    prior written permission of the Apache Software Foundation.
36   *
37   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48   * SUCH DAMAGE.
49   * ====================================================================
50   *
51   * This software consists of voluntary contributions made by many
52   * individuals on behalf of the Apache Software Foundation.  For more
53   * information on the Apache Software Foundation, please see
54   * <http://www.apache.org/>.
55   */
56  
57  import org.apache.turbine.util.security.RoleSet;
58  import org.apache.turbine.util.security.TurbineSecurityException;
59  
60  /***
61   * This class represents a Group of Users in the system that are associated
62   * with specific entity or resource. The users belonging to the Group may have
63   * various Roles. The Permissions to perform actions upon the resource depend
64   * on the Roles in the Group that they are assigned.
65   *
66   * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
67   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
68   * @version $Id: Group.java,v 1.5 2003/04/08 08:48:51 henning Exp $
69   */
70  public interface Group extends SecurityEntity
71  {
72      /***
73       * The name of the <a href="#global">global group</a>
74       */
75      String GLOBAL_GROUP_NAME = "global";
76  
77      /***
78       * Makes changes made to the Group attributes permanent.
79       *
80       * @throws TurbineSecurityException if there is a problem while
81       *  saving data.
82       */
83      void save()
84          throws TurbineSecurityException;
85  
86      /***
87       * Removes a group from the system.
88       *
89       * @throws TurbineSecurityException if the Group could not be removed.
90       */
91      void remove()
92          throws TurbineSecurityException;
93  
94      /***
95       * Renames the role.
96       *
97       * @param name The new Group name.
98       * @throws TurbineSecurityException if the Group could not be renamed.
99       */
100     void rename(String name)
101         throws TurbineSecurityException;
102 
103     /***
104      * Grants a Role in this Group to an User.
105      *
106      * @param user An User.
107      * @param role A Role.
108      * @throws TurbineSecurityException if there is a problem while assigning
109      * the Role.
110      */
111     void grant(User user, Role role)
112         throws TurbineSecurityException;
113 
114     /***
115      * Grants Roles in this Group to an User.
116      *
117      * @param user An User.
118      * @param roleSet A RoleSet.
119      * @throws TurbineSecurityException if there is a problem while assigning
120      * the Roles.
121      */
122     void grant(User user, RoleSet roleSet)
123         throws TurbineSecurityException;
124 
125     /***
126      * Revokes a Role in this Group from an User.
127      *
128      * @param user An User.
129      * @param role A Role.
130      * @throws TurbineSecurityException if there is a problem while unassigning
131      * the Role.
132      */
133     void revoke(User user, Role role)
134         throws TurbineSecurityException;
135 
136     /***
137      * Revokes Roles in this group from an User.
138      *
139      * @param user An User.
140      * @param roleSet a RoleSet.
141      * @throws TurbineSecurityException if there is a problem while unassigning
142      * the Roles.
143      */
144     void revoke(User user, RoleSet roleSet)
145         throws TurbineSecurityException;
146 
147 }