KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > Yasna > forum > Group


1 /**
2  * Copyright (C) 2001 Yasna.com. All rights reserved.
3  *
4  * ===================================================================
5  * The Apache Software License, Version 1.1
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  *
19  * 3. The end-user documentation included with the redistribution,
20  * if any, must include the following acknowledgment:
21  * "This product includes software developed by
22  * Yasna.com (http://www.yasna.com)."
23  * Alternately, this acknowledgment may appear in the software itself,
24  * if and wherever such third-party acknowledgments normally appear.
25  *
26  * 4. The names "Yazd" and "Yasna.com" must not be used to
27  * endorse or promote products derived from this software without
28  * prior written permission. For written permission, please
29  * contact yazd@yasna.com.
30  *
31  * 5. Products derived from this software may not be called "Yazd",
32  * nor may "Yazd" appear in their name, without prior written
33  * permission of Yasna.com.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED. IN NO EVENT SHALL YASNA.COM OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of Yasna.com. For more information
51  * on Yasna.com, please see <http://www.yasna.com>.
52  */

53
54 /**
55  * Copyright (C) 2000 CoolServlets.com. All rights reserved.
56  *
57  * ===================================================================
58  * The Apache Software License, Version 1.1
59  *
60  * Redistribution and use in source and binary forms, with or without
61  * modification, are permitted provided that the following conditions
62  * are met:
63  *
64  * 1. Redistributions of source code must retain the above copyright
65  * notice, this list of conditions and the following disclaimer.
66  *
67  * 2. Redistributions in binary form must reproduce the above copyright
68  * notice, this list of conditions and the following disclaimer in
69  * the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3. The end-user documentation included with the redistribution,
73  * if any, must include the following acknowledgment:
74  * "This product includes software developed by
75  * CoolServlets.com (http://www.coolservlets.com)."
76  * Alternately, this acknowledgment may appear in the software itself,
77  * if and wherever such third-party acknowledgments normally appear.
78  *
79  * 4. The names "Jive" and "CoolServlets.com" must not be used to
80  * endorse or promote products derived from this software without
81  * prior written permission. For written permission, please
82  * contact webmaster@coolservlets.com.
83  *
84  * 5. Products derived from this software may not be called "Jive",
85  * nor may "Jive" appear in their name, without prior written
86  * permission of CoolServlets.com.
87  *
88  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
89  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
90  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
91  * DISCLAIMED. IN NO EVENT SHALL COOLSERVLETS.COM OR
92  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
93  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
94  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
95  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
96  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
97  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
98  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
99  * SUCH DAMAGE.
100  * ====================================================================
101  *
102  * This software consists of voluntary contributions made by many
103  * individuals on behalf of CoolServlets.com. For more information
104  * on CoolServlets.com, please see <http://www.coolservlets.com>.
105  */

106
107 package com.Yasna.forum;
108
109 import java.util.*;
110
111 /**
112  * Organizes Users into a group for easier permissions management at the
113  * Forum level. In this way, Groups essentially serve the same purpose that
114  * they do in Unix or Windows.<p>
115  *
116  * For example, CREATE_THREAD permissions can be set per forum. A forum
117  * administrator may wish to create a "Thread Posters" group that has
118  * CREATE_THREAD permissions in the forum. Then, users can be added to that
119  * group and will automatically receive CREATE_THREAD permissions in that forum.
120  * <p>
121  *
122  * Security for Group objects is provide by GroupProxy protection proxy objects.
123  *
124  * @see User
125  */

126 public interface Group {
127
128     /**
129      * Returns the id of the group.
130      *
131      * @return the id of the group.
132      */

133     public int getID();
134
135     /**
136      * Returns the name of the group. For example, 'XYZ Admins'.
137      *
138      * @return the name of the group.
139      */

140     public String JavaDoc getName();
141
142     /**
143      * Sets the name of the group. For example, 'XYZ Admins'.<p>
144      *
145      * This method is restricted to those with group administration permission.
146      *
147      * @param name the name for the group.
148      * @throws UnauthorizedException if does not have group admin permissions.
149      */

150     public void setName(String JavaDoc name) throws UnauthorizedException;
151
152     /**
153      * Returns the description of the group. The description often summarizes
154      * a group's function, such as 'Administrators of the XYZ forum'.
155      *
156      * @return the description of the group.
157      */

158     public String JavaDoc getDescription();
159
160     /**
161      * This method returns true if the group has automatic membership. If Automatic membership
162      * is turned on, any new member will automatically become a member of that group, and will inherit
163      * the permissions for that group too.
164      * @return
165      */

166     public boolean getAutoGroupMembership();
167
168     /**
169      * this method sets the automatic membership of the group.
170      * this method is restricted to thos with group administration permission.
171      * @param param
172      */

173     public void setAutoGroupMembership(boolean param) throws UnauthorizedException;
174     /**
175      * Sets the description of the group.
176      *
177      * The description often summarizes a group's function, such as
178      * 'Administrators of the XYZ forum'.<p>
179      *
180      * This method is restricted to those with group administration permission.
181      *
182      * @param name the description of the group.
183      * @throws UnauthorizedException if does not have group admin permissions.
184      */

185     public void setDescription(String JavaDoc description) throws UnauthorizedException;
186
187     /**
188      * Grants administrator privileges of the group to a user.<p>
189      *
190      * This method is restricted to those with group administration permission.
191      *
192      * @param user the User to grant adminstrative privileges to.
193      * @throws UnauthorizedException if does not have group admin permissions.
194      */

195     public void addAdministrator(User user) throws UnauthorizedException;
196
197     /**
198      * Revokes administrator privileges of the group to a user.<p>
199      *
200      * This method is restricted to those with group administration permission.
201      *
202      * @param user the User to grant adminstrative privileges to.
203      * @throws UnauthorizedException if does not have group admin permissions.
204      */

205     public void removeAdministrator(User user) throws UnauthorizedException;
206
207     /**
208      * Adds a member to the group.<p>
209      *
210      * This method is restricted to those with group administration permission.
211      *
212      * @param user the User to add to the group.
213      * @throws UnauthorizedException if does not have group admin permissions.
214      */

215     public void addMember(User user) throws UnauthorizedException;
216
217     /**
218      * Removes a member from the group. If the User is not in the group, this
219      * method does nothing.<p>
220      *
221      * This method is restricted to those with group administration permission.
222      *
223      * @param user the User to remove from the group.
224      * @throws UnauthorizedException if does not have group admin permissions.
225      */

226     public void removeMember(User user) throws UnauthorizedException;
227
228     /**
229      * Returns true if the User has group administrator permissions. Group
230      * administrators are also considered to be members.
231      *
232      * @return true if the User is an administrator of the group.
233      */

234     public boolean isAdministrator(User user);
235
236     /**
237      * Returns true if if the User is a member of the group.
238      *
239      * @return true if the User is a member of the group.
240      */

241     public boolean isMember(User user);
242
243     /**
244      * Returns the number of group administrators.
245      *
246      * @return the number of group administrators.
247      */

248     public int getAdministratorCount();
249
250     /**
251      * Returns the number of group members.
252      *
253      * @return the number of group members.
254      */

255     public int getMemberCount();
256
257     /**
258      * An iterator for all the users that are members of the group.
259      *
260      * @return an Iterator for all members of the group.
261      */

262     public Iterator members();
263
264     /**
265      * An iterator for all the users that are administrators of the group.
266      *
267      * @return an Iterator for all administrators of the group.
268      */

269     public Iterator administrators();
270
271     /**
272      * Returns the permissions for the group that correspond to the
273      * passed-in Authorization.
274      *
275      * @param authorization the auth token to lookup permissions for.
276      */

277     public abstract ForumPermissions getPermissions(Authorization authorization);
278
279     /**
280      * Returns true if the handle on the object has the permission specified.
281      * A list of possible permissions can be found in the ForumPermissions
282      * class. Certain methods of this class are restricted to certain
283      * permissions as specified in the method comments.
284      *
285      * @param type a permission type.
286      * @return true if the specified permission is valid.
287      * @see ForumPermissions
288      */

289     public boolean hasPermission(int type);
290 }
291
Popular Tags