KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mvnforum > auth > MVNForumPermission


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/auth/MVNForumPermission.java,v 1.15 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.15 $
5  * $Date: 2006/04/14 17:05:26 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding mvnForum MUST remain
12  * intact in the scripts and in the outputted HTML.
13  * The "powered by" text/logo with a link back to
14  * http://www.mvnForum.com and http://www.MyVietnam.net in
15  * the footer of the pages MUST remain visible when the pages
16  * are viewed on the internet or intranet.
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31  *
32  * Support can be obtained from support forums at:
33  * http://www.mvnForum.com/mvnforum/index
34  *
35  * Correspondence and Marketing Questions can be sent to:
36  * info at MyVietnam net
37  *
38  * @author: Minh Nguyen
39  * @author: Mai Nguyen
40  */

41 package com.mvnforum.auth;
42
43 public interface MVNForumPermission {
44
45 /**************************************************************************
46  * Below are constant, once a constant have been assigned
47  * a value, it CANNOT be changed (for compatibility).
48  **************************************************************************/

49
50
51 /**************************************************************************
52  * Special permissions, range from 0 to 99
53  **************************************************************************/

54     /**
55      * No permission, just use to reserved the value 0
56      * Normally, this permission should never be used.
57      */

58     public static final int PERMISSION_EMPTY = 0;
59
60     /**
61      * All users will have this permission once they have logged in.
62      */

63     public static final int PERMISSION_AUTHENTICATED = 1;
64
65     /**
66      * If a user have this permission, it means he is revoked all permissions
67      * This permission is still reserved for future uses.
68      */

69     public static final int PERMISSION_NO_PERMISSIONS = 2;
70
71     /**
72      * All users will have this permission once they have logged in
73      * and they have activated their account using email activation process
74      */

75     public static final int PERMISSION_ACTIVATED = 3;
76
77
78 /**************************************************************************
79  * Combined permissions, range from 100 to 199
80  * A permission in this range is the combination of other individual permissions
81  * NOTE: values from 200 to (1000-1) are still reserved
82  **************************************************************************/

83     /**
84      * This permission is combination of all permissions,
85      * but excludes all special permissions.
86      */

87     public static final int PERMISSION_SYSTEM_ADMIN = 100;
88
89     /**
90      */

91     public static final int PERMISSION_GROUP_ADMIN = 101;
92
93     /**
94      */

95     public static final int PERMISSION_GROUP_MODERATOR = 102;
96
97     /**
98      */

99     public static final int PERMISSION_USER_ADMIN = 103;
100
101     /**
102      */

103     public static final int PERMISSION_USER_MODERATOR = 104;
104
105     /**
106      */

107     public static final int PERMISSION_FORUM_ADMIN = 105;
108
109     /**
110      */

111     public static final int PERMISSION_FORUM_MODERATOR = 106;
112
113     /**
114      * Reserved
115      */

116     public static final int PERMISSION_CATEGORY_ADMIN = 107;
117
118     /**
119      * Reserved
120      */

121     public static final int PERMISSION_CATEGORY_MODERATOR = 108;
122
123     /**
124      * Can:
125      * - login, read thread and post, reply to a thread
126      */

127     public static final int PERMISSION_LIMITED_USER = 109;
128
129     /**
130      * Can:
131      * - login, read thread and post, reply to a thread
132      * - Add thread, use avatar, get attachment
133      */

134     public static final int PERMISSION_NORMAL_USER = 110;
135
136     /**
137      * Can:
138      * - login, read thread and post, reply to a thread
139      * - Add thread, use avatar, get attachment
140      * - use attachment, create poll
141      */

142     public static final int PERMISSION_POWER_USER = 111;
143
144
145 /**************************************************************************
146  * Individual Permissions, range begin at 1000
147  * A permission in this range is an single permission
148  * A Combined Permission usually includes some Individual Permissions
149  **************************************************************************/

150
151 /**************************************************************************
152  * Individual Permissions for global usages, range from 1000 to (2000-1)
153  * NOTE: values from 2000 and above are still reserved
154  **************************************************************************/

155     /**************************************************************************
156      * Individual Global Permissions which high-level permission, range from 1000 to (1100-1)
157      **************************************************************************/

158     /**
159      * Login
160      */

161     public static final int PERMISSION_LOGIN = 1000;
162
163     /**
164      * Admin the system, this permission should not be used
165      * instead, use the combined PERMISSION_SYSTEM_ADMIN
166      */

167     //public static final int PERMISSION_ADMIN_SYSTEM = 1001;
168

169     /**
170      * Add a Forum
171      */

172     public static final int PERMISSION_ADD_FORUM = 1002;
173
174     /**
175      * Add a Category
176      */

177     public static final int PERMISSION_ADD_CATEGORY = 1003;
178
179     /**
180      * Edit a Category
181      */

182     public static final int PERMISSION_EDIT_CATEGORY = 1004;
183
184     /**
185      * Delete a Category
186      */

187     public static final int PERMISSION_DELETE_CATEGORY = 1005;
188
189     /**
190      * Send Mail
191      */

192     public static final int PERMISSION_SEND_MAIL = 1006;
193
194     /**
195      * Permission to bypass/ignore the private forum
196      */

197     public static final int PERMISSION_BYPASS_PRIVATE_FORUM = 1007;
198
199     /**************************************************************************
200      * Individual Global Permissions which low-level permission, range from 1100 to (2000-1)
201      **************************************************************************/

202     /**
203      * Use Private Message
204      */

205     public static final int PERMISSION_USE_MESSAGE = 1100;
206
207     /**
208      * Use Avatar
209      */

210     public static final int PERMISSION_USE_AVATAR = 1101;
211
212     /**
213      * Use (upload) Attachment in Private Message
214      */

215     public static final int PERMISSION_ADD_MESSAGE_ATTACHMENT = 1102;
216
217
218 /**************************************************************************
219  * Individual Permissions that can be applied for individual forum usages,
220  * (of course it can be applied to all forums), range from 2000 to (3000-1)
221  **************************************************************************/

222     /**************************************************************************
223      * Individual Permissions which high-level permission, range from 2000 to (2100-1)
224      * Usually Forum Admin has these permissions
225      **************************************************************************/

226     /**
227      * Edit a Forum
228      */

229     public static final int PERMISSION_EDIT_FORUM = 2000;
230
231     /**
232      * Delete a Forum
233      */

234     public static final int PERMISSION_DELETE_FORUM = 2001;
235
236     /**
237      * Assign permission
238      */

239     public static final int PERMISSION_ASSIGN_TO_FORUM = 2002;
240
241     /**************************************************************************
242      * Individual Permissions which low-level permission, range from (2100 to 3000-1)
243      **************************************************************************/

244     /**
245      * Read post in the forum
246      */

247     public static final int PERMISSION_READ_POST = 2100;
248
249     /**
250      * Create add thread
251      */

252     public static final int PERMISSION_ADD_THREAD = 2101;
253
254     /**
255      * Add a post (reply to a thread)
256      */

257     public static final int PERMISSION_ADD_POST = 2102;
258
259     /**
260      * Edit post in the forum
261      * This permission allow edit all posts and attach all files to the post
262      */

263     public static final int PERMISSION_EDIT_POST = 2103;
264
265     /**
266      * Delete post in the forum
267      */

268     public static final int PERMISSION_DELETE_POST = 2104;
269
270     /**
271      * Add a poll
272      */

273     public static final int PERMISSION_ADD_POLL = 2105;
274
275     /**
276      * Edit a poll
277      */

278     public static final int PERMISSION_EDIT_POLL = 2106;
279
280     /**
281      * Delete a poll
282      */

283     public static final int PERMISSION_DELETE_POLL = 2107;
284
285     /**
286      * Can attach files when posting
287      */

288     public static final int PERMISSION_ADD_ATTACHMENT = 2108;
289
290     /**
291      * Can download attached files
292      */

293     public static final int PERMISSION_GET_ATTACHMENT = 2109;
294
295     /**
296      * Can moderate the forum, such as lock thread or approve pending threads.
297      * Please note that there is not PERMISSION_MODERATE_POST because
298      * who can moderate threads obviously can moderate posts too.
299      */

300     public static final int PERMISSION_MODERATE_THREAD = 2110;
301
302     /**
303      * Can edit user own posts
304      */

305     public static final int PERMISSION_EDIT_OWN_POST = 2111;
306
307
308
309 /**************************************************************************
310  * MVN CMS Permission Constants
311  * Individual Permissions that can be applied for individual Channel usages,
312  * (of course it can be applied to all channels), range from 10,000 to (20,000-1)
313  **************************************************************************/

314   /**************************************************************************
315    * Individual Permissions which high-level permission, range from 10,000 to (10,099)
316    * Usually CMS Admin has these permissions
317    **************************************************************************/

318
319     /**
320      * @todo add the description here
321      */

322     public static final int PERMISSION_CMS_ADD_CHANNEL = 10000;
323
324     /**
325      *
326      */

327     public static final int PERMISSION_CMS_EDIT_CHANNEL = 10001;
328
329     /**
330      *
331      */

332     public static final int PERMISSION_CMS_DELETE_CHANNEL = 10002;
333
334   /**************************************************************************
335    * Individual Permissions which low-level permission, range from (10,100 to 10,999)
336    **************************************************************************/

337     /**
338      *
339      */

340     public static final int PERMISSION_CMS_WRITE_CONTENT = 10100;
341
342     /**
343      *
344      */

345     public static final int PERMISSION_CMS_EDIT_CONTENT = 10101;
346
347     /**
348      *
349      */

350     public static final int PERMISSION_CMS_APPROVE_CONTENT = 10102;
351
352     /**
353      *
354      */

355     public static final int PERMISSION_CMS_PUBLISH_CONTENT = 10103;
356
357     /**
358      *
359      */

360     public static final int PERMISSION_CMS_DELETE_CONTENT = 10104;
361
362     /**
363      *
364      */

365     public static final int PERMISSION_CMS_UPLOAD_FILE = 10105;
366
367
368
369 /**************************************************************************
370  * Special permissions methods
371  **************************************************************************/

372
373     public boolean isAuthenticated();
374     public void ensureIsAuthenticated() throws AuthenticationException;
375
376     public boolean isActivated();
377     public void ensureIsActivated() throws AuthenticationException;
378
379 /**************************************************************************
380  * The below methods are used to check global permissions
381  **************************************************************************/

382
383     public boolean canLogin();
384     public void ensureCanLogin() throws AuthenticationException;
385
386     public boolean canAdminSystem();
387     public void ensureCanAdminSystem() throws AuthenticationException;
388
389     public boolean canAddForum();
390     public void ensureCanAddForum() throws AuthenticationException;
391
392     public boolean canAddCategory();
393     public void ensureCanAddCategory() throws AuthenticationException;
394
395     public boolean canEditCategory();
396     public void ensureCanEditCategory() throws AuthenticationException;
397
398     public boolean canDeleteCategory();
399     public void ensureCanDeleteCategory() throws AuthenticationException;
400
401     public boolean canSendMail();
402     public void ensureCanSendMail() throws AuthenticationException;
403
404     public boolean canUseAvatar();
405     public void ensureCanUseAvatar() throws AuthenticationException;
406
407     public boolean canUseMessage();
408     public void ensureCanUseMessage() throws AuthenticationException;
409
410     public boolean canAddMessageAttachment();
411     public void ensureCanAddMessageAttachment() throws AuthenticationException;
412
413 /**************************************************************************
414  * The below methods are used to check individual forum permissions
415  **************************************************************************/

416
417     public boolean canEditForum(int forumID);
418     public void ensureCanEditForum(int forumID) throws AuthenticationException;
419
420     public boolean canDeleteForum(int forumID);
421     public void ensureCanDeleteForum(int forumID) throws AuthenticationException;
422
423     public boolean canAssignToForum(int forumID);
424     public void ensureCanAssignToForum(int forumID) throws AuthenticationException;
425
426     public boolean canReadPost(int forumID);
427     public void ensureCanReadPost(int forumID) throws AuthenticationException;
428
429     public boolean canAddThread(int forumID);
430     public void ensureCanAddThread(int forumID) throws AuthenticationException;
431
432     public boolean canAddPost(int forumID);
433     public void ensureCanAddPost(int forumID) throws AuthenticationException;
434
435     public boolean canEditPost(int forumID);
436     public void ensureCanEditPost(int forumID) throws AuthenticationException;
437
438     public boolean canEditOwnPost(int forumID);
439     public void ensureCanEditOwnPost(int forumID) throws AuthenticationException;
440
441     public boolean canDeletePost(int forumID);
442     public void ensureCanDeletePost(int forumID) throws AuthenticationException;
443
444     public boolean canAddPoll(int forumID);
445     public void ensureCanAddPoll(int forumID) throws AuthenticationException;
446
447     public boolean canEditPoll(int forumID);
448     public void ensureCanEditPoll(int forumID) throws AuthenticationException;
449
450     public boolean canDeletePoll(int forumID);
451     public void ensureCanDeletePoll(int forumID) throws AuthenticationException;
452
453     public boolean canAddAttachment(int forumID);
454     public void ensureCanAddAttachment(int forumID) throws AuthenticationException;
455
456     public boolean canGetAttachment(int forumID);
457     public void ensureCanGetAttachment(int forumID) throws AuthenticationException;
458
459     public boolean canModerateThread(int forumID);
460     public void ensureCanModerateThread(int forumID) throws AuthenticationException;
461
462 /**************************************************************************
463  * The below methods are used to check global CHANNEL permissions
464  **************************************************************************/

465
466     public boolean canAddChannel();
467     public void ensureCanAddChannel() throws AuthenticationException;
468
469     public boolean canEditChannel();
470     public void ensureCanEditChannel() throws AuthenticationException;
471
472     public boolean canDeleteChannel();
473     public void ensureCanDeleteChannel() throws AuthenticationException;
474
475 /**************************************************************************
476  * The below methods are used to check individual CHANNEL permissions
477  **************************************************************************/

478
479     public boolean canWriteContent(int channelID);
480     public void ensureCanWriteContent(int channelID) throws AuthenticationException;
481
482     public boolean canEditContent(int channelID);
483     public void ensureCanEditContent(int channelID) throws AuthenticationException;
484
485     public boolean canApproveContent(int channelID);
486     public void ensureCanApproveContent(int channelID) throws AuthenticationException;
487
488     public boolean canPublishContent(int channelID);
489     public void ensureCanPublishContent(int channelID) throws AuthenticationException;
490
491     public boolean canDeleteContent(int channelID);
492     public void ensureCanDeleteContent(int channelID) throws AuthenticationException;
493
494     /**************************************************************************
495      * The below methods are utility methods to support checking FORUM permission
496      **************************************************************************/

497
498     public boolean canEditAnyForum();
499     public void ensureCanEditAnyForum() throws AuthenticationException;
500
501     public boolean canModerateThreadInAnyForum();
502     public void ensureCanModerateThreadInAnyForum() throws AuthenticationException;
503
504     /**************************************************************************
505      * The below methods are utility methods to support checking CHANNEL permission
506      **************************************************************************/

507     public boolean canWriteContentInAnyChannel();
508     public void ensureCanWriteContentInAnyChannel() throws AuthenticationException;
509
510     public boolean canEditContentInAnyChannel();
511     public void ensureCanEditContentInAnyChannel() throws AuthenticationException;
512
513     public boolean canApproveContentInAnyChannel();
514     public void ensureCanApproveContentInAnyChannel() throws AuthenticationException;
515
516     public boolean canPublishContentInAnyChannel();
517     public void ensureCanPublishContentInAnyChannel() throws AuthenticationException;
518
519 }
520
Free Books   Free Magazines  
Popular Tags