KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fulcrum > security > entity > Group


1 package org.apache.fulcrum.security.entity;
2
3 /* ====================================================================
4  * The Apache Software License, Version 1.1
5  *
6  * Copyright (c) 2001 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.fulcrum.security.util.RoleSet;
58 import org.apache.fulcrum.security.util.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  * @version $Id: Group.java,v 1.1 2004/11/12 10:25:51 epugh Exp $
68  */

69 public interface Group extends SecurityEntity
70 {
71     /**
72      * The name of the <a HREF="#global">global group</a>
73      */

74     public static final String JavaDoc GLOBAL_GROUP_NAME = "global";
75
76     /**
77      * Returns the name of this object.
78      *
79      * @return The name of the object.
80      */

81     String JavaDoc getName();
82
83     /**
84      * Sets the name of this object.
85      *
86      * @param name The name of the object.
87      */

88     void setName(String JavaDoc name);
89
90     /**
91      * Makes changes made to the Group attributes permanent.
92      *
93      * @throws TurbineSecurityException if there is a problem while
94      * saving data.
95      */

96     void save()
97         throws TurbineSecurityException;
98
99     /**
100      * Removes a group from the system.
101      *
102      * @throws TurbineSecurityException if the Group could not be removed.
103      */

104     void remove()
105         throws TurbineSecurityException;
106
107     /**
108      * Renames the role.
109      *
110      * @param name The new Group name.
111      * @throws TurbineSecurityException if the Group could not be renamed.
112      */

113     void rename(String JavaDoc name)
114         throws TurbineSecurityException;
115
116     /**
117      * Grants a Role in this Group to an User.
118      *
119      * @param user An User.
120      * @param role A Role.
121      * @throws TurbineSecurityException if there is a problem while assigning
122      * the Role.
123      */

124     void grant(User user, Role role)
125         throws TurbineSecurityException;
126
127     /**
128      * Grants Roles in this Group to an User.
129      *
130      * @param user An User.
131      * @param roleSet A RoleSet.
132      * @throws TurbineSecurityException if there is a problem while assigning
133      * the Roles.
134      */

135     void grant(User user, RoleSet roleSet)
136         throws TurbineSecurityException;
137
138     /**
139      * Revokes a Role in this Group from an User.
140      *
141      * @param user An User.
142      * @param role A Role.
143      * @throws TurbineSecurityException if there is a problem while unassigning
144      * the Role.
145      */

146     void revoke(User user, Role role)
147         throws TurbineSecurityException;
148
149     /**
150      * Revokes Roles in this group from an User.
151      *
152      * @param user An User.
153      * @param roleSet a RoleSet.
154      * @throws TurbineSecurityException if there is a problem while unassigning
155      * the Roles.
156      */

157     void revoke(User user, RoleSet roleSet)
158         throws TurbineSecurityException;
159
160 }
161
Popular Tags