KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nemesis > forum > Group


1 /*
2  * NEMESIS-FORUM.
3  * Copyright (C) 2002 David Laurent(lithium2@free.fr). All rights reserved.
4  *
5  * Copyright (c) 2000 The Apache Software Foundation. All rights reserved.
6  *
7  * Copyright (C) 2001 Yasna.com. All rights reserved.
8  *
9  * Copyright (C) 2000 CoolServlets.com. All rights reserved.
10  *
11  * NEMESIS-FORUM. is free software; you can redistribute it and/or
12  * modify it under the terms of the Apache Software License, Version 1.1,
13  * or (at your option) any later version.
14  *
15  * NEMESIS-FORUM core framework, NEMESIS-FORUM backoffice, NEMESIS-FORUM frontoffice
16  * application are parts of NEMESIS-FORUM and are distributed under
17  * same terms of licence.
18  *
19  *
20  * NEMESIS-FORUM includes software developed by the Apache Software Foundation (http://www.apache.org/)
21  * and software developed by CoolServlets.com (http://www.coolservlets.com).
22  * and software developed by Yasna.com (http://www.yasna.com).
23  *
24  */

25
26
27 package org.nemesis.forum;
28
29 import java.util.Iterator JavaDoc;
30
31 import org.nemesis.forum.exception.UnauthorizedException;
32
33 /**
34  * Organizes Users into a group for easier permissions management at the
35  * Forum level. In this way, Groups essentially serve the same purpose that
36  * they do in Unix or Windows.<p>
37  *
38  * For example, CREATE_THREAD permissions can be set per forum. A forum
39  * administrator may wish to create a "Thread Posters" group that has
40  * CREATE_THREAD permissions in the forum. Then, users can be added to that
41  * group and will automatically receive CREATE_THREAD permissions in that forum.
42  * <p>
43  *
44  * Security for Group objects is provide by GroupProxy protection proxy objects.
45  *
46  * @see User
47  */

48 public interface Group {
49
50     /**
51      * Returns the id of the group.
52      *
53      * @return the id of the group.
54      */

55     public int getID();
56
57     /**
58      * Returns the name of the group. For example, 'XYZ Admins'.
59      *
60      * @return the name of the group.
61      */

62     public String JavaDoc getName();
63
64     /**
65      * Sets the name of the group. For example, 'XYZ Admins'.<p>
66      *
67      * This method is restricted to those with group administration permission.
68      *
69      * @param name the name for the group.
70      * @throws UnauthorizedException if does not have group admin permissions.
71      */

72     public void setName(String JavaDoc name) throws UnauthorizedException;
73
74     /**
75      * Returns the description of the group. The description often summarizes
76      * a group's function, such as 'Administrators of the XYZ forum'.
77      *
78      * @return the description of the group.
79      */

80     public String JavaDoc getDescription();
81
82     /**
83      * Sets the description of the group.
84      *
85      * The description often summarizes a group's function, such as
86      * 'Administrators of the XYZ forum'.<p>
87      *
88      * This method is restricted to those with group administration permission.
89      *
90      * @param name the description of the group.
91      * @throws UnauthorizedException if does not have group admin permissions.
92      */

93     public void setDescription(String JavaDoc description) throws UnauthorizedException;
94
95     /**
96      * Grants administrator privileges of the group to a user.<p>
97      *
98      * This method is restricted to those with group administration permission.
99      *
100      * @param user the User to grant adminstrative privileges to.
101      * @throws UnauthorizedException if does not have group admin permissions.
102      */

103     public void addAdministrator(User user) throws UnauthorizedException;
104
105     /**
106      * Revokes administrator privileges of the group to a user.<p>
107      *
108      * This method is restricted to those with group administration permission.
109      *
110      * @param user the User to grant adminstrative privileges to.
111      * @throws UnauthorizedException if does not have group admin permissions.
112      */

113     public void removeAdministrator(User user) throws UnauthorizedException;
114
115     /**
116      * Adds a member to the group.<p>
117      *
118      * This method is restricted to those with group administration permission.
119      *
120      * @param user the User to add to the group.
121      * @throws UnauthorizedException if does not have group admin permissions.
122      */

123     public void addMember(User user) throws UnauthorizedException;
124
125     /**
126      * Removes a member from the group. If the User is not in the group, this
127      * method does nothing.<p>
128      *
129      * This method is restricted to those with group administration permission.
130      *
131      * @param user the User to remove from the group.
132      * @throws UnauthorizedException if does not have group admin permissions.
133      */

134     public void removeMember(User user) throws UnauthorizedException;
135
136     /**
137      * Returns true if the User has group administrator permissions. Group
138      * administrators are also considered to be members.
139      *
140      * @return true if the User is an administrator of the group.
141      */

142     public boolean isAdministrator(User user);
143
144     /**
145      * Returns true if if the User is a member of the group.
146      *
147      * @return true if the User is a member of the group.
148      */

149     public boolean isMember(User user);
150
151     /**
152      * Returns the number of group administrators.
153      *
154      * @return the number of group administrators.
155      */

156     public int getAdministratorCount();
157
158     /**
159      * Returns the number of group members.
160      *
161      * @return the number of group members.
162      */

163     public int getMemberCount();
164
165     /**
166      * An iterator for all the users that are members of the group.
167      *
168      * @return an Iterator for all members of the group.
169      */

170     public Iterator JavaDoc members();
171
172     /**
173      * An iterator for all the users that are administrators of the group.
174      *
175      * @return an Iterator for all administrators of the group.
176      */

177     public Iterator JavaDoc administrators();
178
179     /**
180      * Returns the permissions for the group that correspond to the
181      * passed-in Authorization.
182      *
183      * @param authorization the auth token to lookup permissions for.
184      */

185     public abstract ForumPermissions getPermissions(Authorization authorization);
186
187     /**
188      * Returns true if the handle on the object has the permission specified.
189      * A list of possible permissions can be found in the ForumPermissions
190      * class. Certain methods of this class are restricted to certain
191      * permissions as specified in the method comments.
192      *
193      * @param type a permission type.
194      * @return true if the specified permission is valid.
195      * @see ForumPermissions
196      */

197     public boolean hasPermission(int type);
198 }
199
Popular Tags