Source Code Cross Referenced for AbstractPermission.java in  » Forum » mvnforum-1.1 » com » mvnforum » auth » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Forum » mvnforum 1.1 » com.mvnforum.auth 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/auth/AbstractPermission.java,v 1.51 2007/12/20 06:55:42 minhnn Exp $
0003:         * $Author: minhnn $
0004:         * $Revision: 1.51 $
0005:         * $Date: 2007/12/20 06:55:42 $
0006:         *
0007:         * ====================================================================
0008:         *
0009:         * Copyright (C) 2002-2007 by MyVietnam.net
0010:         *
0011:         * All copyright notices regarding mvnForum MUST remain
0012:         * intact in the scripts and in the outputted HTML.
0013:         * The "powered by" text/logo with a link back to
0014:         * http://www.mvnForum.com and http://www.MyVietnam.net in
0015:         * the footer of the pages MUST remain visible when the pages
0016:         * are viewed on the internet or intranet.
0017:         *
0018:         * This program is free software; you can redistribute it and/or modify
0019:         * it under the terms of the GNU General Public License as published by
0020:         * the Free Software Foundation; either version 2 of the License, or
0021:         * any later version.
0022:         *
0023:         * This program is distributed in the hope that it will be useful,
0024:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0025:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0026:         * GNU General Public License for more details.
0027:         *
0028:         * You should have received a copy of the GNU General Public License
0029:         * along with this program; if not, write to the Free Software
0030:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0031:         *
0032:         * Support can be obtained from support forums at:
0033:         * http://www.mvnForum.com/mvnforum/index
0034:         *
0035:         * Correspondence and Marketing Questions can be sent to:
0036:         * info at MyVietnam net
0037:         *
0038:         * @author: Minh Nguyen
0039:         * @author: Mai  Nguyen
0040:         */
0041:        package com.mvnforum.auth;
0042:
0043:        import net.myvietnam.mvncore.exception.BadInputException;
0044:        import net.myvietnam.mvncore.exception.NotLoginException;
0045:
0046:        public abstract class AbstractPermission implements  MVNForumPermission {
0047:
0048:            /**************************************************************************
0049:             * global permissions variables
0050:             **************************************************************************/
0051:            protected boolean authenticated = false;
0052:
0053:            protected boolean activated = false;
0054:
0055:            protected boolean login = false;
0056:
0057:            protected boolean adminSystem = false;
0058:
0059:            protected boolean addForum = false;
0060:
0061:            protected boolean addCategory = false;
0062:
0063:            protected boolean editCategory = false;
0064:
0065:            protected boolean deleteCategory = false;
0066:
0067:            protected boolean sendMail = false;
0068:
0069:            protected boolean moderateUser = false;
0070:
0071:            protected boolean useAvatar = false;
0072:
0073:            protected boolean useMessage = false;
0074:
0075:            protected boolean addMessageAttachment = false;
0076:
0077:            protected boolean useAlbum = false;
0078:
0079:            protected boolean manageOrphanPoll = false;
0080:
0081:            protected boolean manageAlbumItemPoll = false;
0082:
0083:            protected boolean setPollToAnonymousType = false;
0084:
0085:            protected boolean haveRoleEditor = false;
0086:
0087:            protected boolean haveRoleChiefEditor = false;
0088:
0089:            protected boolean manageInfoInDay = false;
0090:
0091:            protected boolean editCDSLayout = false;
0092:
0093:            /**************************************************************************
0094:             * individual forum permissions variables
0095:             **************************************************************************/
0096:            protected ForumListPermission editForum = new ForumListPermission();
0097:
0098:            protected ForumListPermission deleteForum = new ForumListPermission();
0099:
0100:            protected ForumListPermission assignToForum = new ForumListPermission();
0101:
0102:            protected ForumListPermission readPost = new ForumListPermission();
0103:
0104:            protected ForumListPermission addThread = new ForumListPermission();
0105:
0106:            protected ForumListPermission addPost = new ForumListPermission();
0107:
0108:            protected ForumListPermission editPost = new ForumListPermission();
0109:
0110:            protected ForumListPermission deletePost = new ForumListPermission();
0111:
0112:            protected ForumListPermission addPoll = new ForumListPermission();
0113:
0114:            protected ForumListPermission editPoll = new ForumListPermission();
0115:
0116:            protected ForumListPermission deletePoll = new ForumListPermission();
0117:
0118:            protected ForumListPermission addAttachment = new ForumListPermission();
0119:
0120:            protected ForumListPermission getAttachment = new ForumListPermission();
0121:
0122:            protected ForumListPermission moderateThread = new ForumListPermission();
0123:
0124:            protected ForumListPermission editOwnPost = new ForumListPermission();
0125:
0126:            protected ForumListPermission editOwnPoll = new ForumListPermission();
0127:
0128:            /**************************************************************************
0129:             * global CHANNEL permissions variables
0130:             **************************************************************************/
0131:            protected boolean addChannel = false;
0132:
0133:            protected boolean editChannel = false;
0134:
0135:            protected boolean deleteChannel = false;
0136:
0137:            /**************************************************************************
0138:             * individual STEP And CHANNEL permissions variables
0139:             **************************************************************************/
0140:            protected ChannelListPermission writeContent = new ChannelListPermission();
0141:
0142:            protected StepAndChannelListPermission writeContentInStepWithChannel = new StepAndChannelListPermission();
0143:
0144:            protected ChannelListPermission editContent = new ChannelListPermission();
0145:
0146:            //---------------------------------------------------------------------
0147:            protected StepAndChannelListPermission editContentInStepWithChannel = new StepAndChannelListPermission();
0148:
0149:            protected ChannelListPermission approveContent = new ChannelListPermission();
0150:
0151:            protected ChannelListPermission publishContent = new ChannelListPermission();
0152:
0153:            protected ChannelListPermission deleteContent = new ChannelListPermission();
0154:
0155:            //---------------------------------------------------------------------
0156:            protected StepAndChannelListPermission deleteContentInStepWithChannel = new StepAndChannelListPermission();
0157:
0158:            protected StepAndChannelListPermission viewContentInStepWithChannel = new StepAndChannelListPermission();
0159:
0160:            protected StepAndChannelListPermission viewContentStepWithChannel = new StepAndChannelListPermission();
0161:
0162:            protected StepAndChannelListPermission goToContentStepWithChannel = new StepAndChannelListPermission();
0163:
0164:            protected StepAndChannelListPermission deployContentInStepWithChannel = new StepAndChannelListPermission();
0165:
0166:            /**************************************************************************
0167:             * global Ads permissions variables
0168:             **************************************************************************/
0169:            protected boolean manageAds = false;
0170:
0171:            protected boolean addZone = false;
0172:
0173:            protected boolean editZone = false;
0174:
0175:            protected boolean deleteZone = false;
0176:
0177:            protected boolean addBanner = false;
0178:
0179:            protected boolean editBanner = false;
0180:
0181:            protected boolean deleteBanner = false;
0182:
0183:            protected boolean viewZone = false;
0184:
0185:            protected boolean viewBanner = false;
0186:
0187:            protected boolean uploadMedia = false;
0188:
0189:            /**
0190:             * constructor
0191:             */
0192:            protected AbstractPermission() {
0193:            }
0194:
0195:            /**************************************************************************
0196:             * The below methods are static methods
0197:             **************************************************************************/
0198:
0199:            public static String getDescription(int permission)
0200:                    throws BadInputException {
0201:                String desc = "";
0202:
0203:                switch (permission) {
0204:                /**************************************************************************
0205:                 * Combined permissions
0206:                 **************************************************************************/
0207:                case PERMISSION_SYSTEM_ADMIN:
0208:                    desc = "System Admin (Combined Permission)";
0209:                    break;
0210:
0211:                case PERMISSION_FORUM_ADMIN:
0212:                    desc = "Forum Admin (Combined Permission)";
0213:                    break;
0214:
0215:                case PERMISSION_FORUM_MODERATOR:
0216:                    desc = "Forum Moderator (Combined Permission)";
0217:                    break;
0218:
0219:                case PERMISSION_LIMITED_USER:
0220:                    desc = "Limited User (Combined Permission)";
0221:                    break;
0222:
0223:                case PERMISSION_NORMAL_USER:
0224:                    desc = "Normal User (Combined Permission)";
0225:                    break;
0226:
0227:                case PERMISSION_POWER_USER:
0228:                    desc = "Power User (Combined Permission)";
0229:                    break;
0230:
0231:                /**************************************************************************
0232:                 * Individual permissions
0233:                 **************************************************************************/
0234:                case PERMISSION_LOGIN:
0235:                    desc = "Can Login";
0236:                    break;
0237:
0238:                //case PERMISSION_ADMIN_SYSTEM:
0239:                //    desc = "Admin System";
0240:                //    break;
0241:
0242:                case PERMISSION_ADD_FORUM:
0243:                    desc = "Add Forum";
0244:                    break;
0245:
0246:                case PERMISSION_EDIT_FORUM:
0247:                    desc = "Edit Forum";
0248:                    break;
0249:
0250:                case PERMISSION_DELETE_FORUM:
0251:                    desc = "Delete Forum";
0252:                    break;
0253:
0254:                case PERMISSION_ASSIGN_TO_FORUM:
0255:                    desc = "Assign To Forum";
0256:                    break;
0257:
0258:                case PERMISSION_ADD_CATEGORY:
0259:                    desc = "Add Category";
0260:                    break;
0261:
0262:                case PERMISSION_EDIT_CATEGORY:
0263:                    desc = "Edit Category";
0264:                    break;
0265:
0266:                case PERMISSION_DELETE_CATEGORY:
0267:                    desc = "Delete Category";
0268:                    break;
0269:
0270:                case PERMISSION_SEND_MAIL:
0271:                    desc = "Send Mail";
0272:                    break;
0273:
0274:                case PERMISSION_MODERATE_USER:
0275:                    desc = "Moderate User";
0276:                    break;
0277:
0278:                case PERMISSION_BYPASS_PRIVATE_FORUM:
0279:                    desc = "Bypass Private Forum";
0280:                    break;
0281:
0282:                case PERMISSION_USE_MESSAGE:
0283:                    desc = "Use Private Message";
0284:                    break;
0285:
0286:                case PERMISSION_ADD_MESSAGE_ATTACHMENT:
0287:                    desc = "Upload Attachment in Private Message";
0288:                    break;
0289:
0290:                case PERMISSION_USE_AVATAR:
0291:                    desc = "Use Avatar";
0292:                    break;
0293:
0294:                case PERMISSION_USE_ALBUM:
0295:                    desc = "Use Album";
0296:                    break;
0297:
0298:                case PERMISSION_MANAGE_ORPHAN_POLL:
0299:                    desc = "Manage Orphan Poll";
0300:                    break;
0301:
0302:                case PERMISSION_MANAGE_ALBUMITEM_POLL:
0303:                    desc = "Manage Album Item Poll";
0304:                    break;
0305:
0306:                case PERMISSION_SET_POLL_TO_ANONYMOUS_TYPE:
0307:                    desc = "Set Poll To Anonymous Type";
0308:                    break;
0309:
0310:                case PERMISSION_READ_POST:
0311:                    desc = "Read Post";
0312:                    break;
0313:
0314:                case PERMISSION_ADD_THREAD:
0315:                    desc = "Add Thread";
0316:                    break;
0317:
0318:                case PERMISSION_ADD_POST:
0319:                    desc = "Add Post";
0320:                    break;
0321:
0322:                case PERMISSION_EDIT_POST:
0323:                    desc = "Edit Post";
0324:                    break;
0325:
0326:                case PERMISSION_DELETE_POST:
0327:                    desc = "Delete Post";
0328:                    break;
0329:
0330:                case PERMISSION_ADD_POLL:
0331:                    desc = "Add Poll";
0332:                    break;
0333:
0334:                case PERMISSION_EDIT_POLL:
0335:                    desc = "Edit Poll";
0336:                    break;
0337:
0338:                case PERMISSION_EDIT_OWN_POLL:
0339:                    desc = "Edit Own Poll";
0340:                    break;
0341:
0342:                case PERMISSION_DELETE_POLL:
0343:                    desc = "Delete Poll";
0344:                    break;
0345:
0346:                case PERMISSION_ADD_ATTACHMENT:
0347:                    desc = "Add Attachment";
0348:                    break;
0349:
0350:                case PERMISSION_GET_ATTACHMENT:
0351:                    desc = "Get Attachment";
0352:                    break;
0353:
0354:                case PERMISSION_MODERATE_THREAD:
0355:                    desc = "Moderate Thread";
0356:                    break;
0357:
0358:                case PERMISSION_EDIT_OWN_POST:
0359:                    desc = "Edit Own Post";
0360:                    break;
0361:
0362:                /**************************************************************************
0363:                 * Individual permissions for CHANNEL
0364:                 **************************************************************************/
0365:                case PERMISSION_CMS_ADD_CHANNEL:
0366:                    desc = "Add Channel";
0367:                    break;
0368:
0369:                case PERMISSION_CMS_EDIT_CHANNEL:
0370:                    desc = "Edit Channel";
0371:                    break;
0372:
0373:                case PERMISSION_CMS_DELETE_CHANNEL:
0374:                    desc = "Delete Channel";
0375:                    break;
0376:
0377:                case PERMISSION_CMS_HAVE_ROLE_EDITOR:
0378:                    desc = "Have Role Editor";
0379:                    break;
0380:
0381:                case PERMISSION_CMS_HAVE_ROLE_CHIEF_EDITOR:
0382:                    desc = "Have Role Chief Editor";
0383:                    break;
0384:
0385:                case PERMISSION_CMS_MANAGE_INFO_IN_DAY:
0386:                    desc = "Manage Info In Day";
0387:                    break;
0388:
0389:                case PERMISSION_CMS_EDIT_CDS_LAYOUT:
0390:                    desc = "Edit CDS Layout";
0391:                    break;
0392:
0393:                case PERMISSION_CMS_WRITE_CONTENT:
0394:                    desc = "Write Content";
0395:                    break;
0396:
0397:                case PERMISSION_CMS_EDIT_CONTENT:
0398:                    desc = "Edit Content";
0399:                    break;
0400:
0401:                case PERMISSION_CMS_APPROVE_CONTENT:
0402:                    desc = "Approve Content";
0403:                    break;
0404:
0405:                case PERMISSION_CMS_PUBLISH_CONTENT:
0406:                    desc = "Publish Content";
0407:                    break;
0408:
0409:                case PERMISSION_CMS_DELETE_CONTENT:
0410:                    desc = "Delete Content";
0411:                    break;
0412:
0413:                //---------------------------------------------------------------------
0414:                case PERMISSION_CMS_VIEW_CONTENT:
0415:                    desc = "View Content";
0416:                    break;
0417:
0418:                case PERMISSION_CMS_DEPLOY_CONTENT:
0419:                    desc = "Deploy Content";
0420:                    break;
0421:
0422:                case PERMISSION_CMS_VIEW_STEP:
0423:                    desc = "View Step";
0424:                    break;
0425:
0426:                case PERMISSION_CMS_GOTO_STEP:
0427:                    desc = "Go to Step";
0428:                    break;
0429:
0430:                /**************************************************************************
0431:                 * Individual permissions for Ads
0432:                 **************************************************************************/
0433:                case PERMISSION_ADS_MANAGE_ADS:
0434:                    desc = "Manage the Ads System";
0435:                    break;
0436:
0437:                case PERMISSION_ADS_ADD_ZONE:
0438:                    desc = "Add Zone";
0439:                    break;
0440:
0441:                case PERMISSION_ADS_EDIT_ZONE:
0442:                    desc = "Edit Zone";
0443:                    break;
0444:
0445:                case PERMISSION_ADS_DELETE_ZONE:
0446:                    desc = "Delete Zone";
0447:                    break;
0448:
0449:                case PERMISSION_ADS_ADD_BANNER:
0450:                    desc = "Add Banner";
0451:                    break;
0452:
0453:                case PERMISSION_ADS_EDIT_BANNER:
0454:                    desc = "Edit Banner";
0455:                    break;
0456:
0457:                case PERMISSION_ADS_DELETE_BANNER:
0458:                    desc = "Delete Banner";
0459:                    break;
0460:
0461:                case PERMISSION_ADS_VIEW_ZONE:
0462:                    desc = "View Zone";
0463:                    break;
0464:
0465:                case PERMISSION_ADS_VIEW_BANNER:
0466:                    desc = "View Banner";
0467:                    break;
0468:
0469:                case PERMISSION_ADS_UPLOAD_MEDIA:
0470:                    desc = "Upload Media";
0471:                    break;
0472:
0473:                default:
0474:                    throw new BadInputException(
0475:                            "Currently do not support permission = "
0476:                                    + permission);
0477:                }//switch
0478:
0479:                return desc;
0480:            }
0481:
0482:            /**************************************************************************
0483:             * Special permissions methods
0484:             **************************************************************************/
0485:
0486:            public boolean isAuthenticated() {
0487:                return authenticated;
0488:            }
0489:
0490:            public void ensureIsAuthenticated() throws AuthenticationException {
0491:                if (authenticated == false) {
0492:                    throw new AuthenticationException(
0493:                            NotLoginException.NOT_LOGIN);
0494:                }
0495:            }
0496:
0497:            public boolean isActivated() {
0498:                return activated;
0499:            }
0500:
0501:            public void ensureIsActivated() throws AuthenticationException {
0502:                if (activated == false) {
0503:                    throw new AuthenticationException(
0504:                            NotLoginException.NOT_ACTIVATED);
0505:                }
0506:            }
0507:
0508:            public static boolean isCombinedPerm(int permission) {
0509:
0510:                int[] allCombinedPerms = MVNForumPermission.forumCombinedPermissionArray;
0511:                for (int i = 0; i < allCombinedPerms.length; i++) {
0512:                    if (permission == allCombinedPerms[i]) {
0513:                        return true;
0514:                    }
0515:                }
0516:                return false;
0517:            }
0518:
0519:            public static boolean isIndividualPerm(int permission) {
0520:                int[] allIndividualPerms = MVNForumPermission.forumIndividualPermissionArray;
0521:                for (int i = 0; i < allIndividualPerms.length; i++) {
0522:                    if (permission == allIndividualPerms[i]) {
0523:                        return true;
0524:                    }
0525:                }
0526:                return false;
0527:            }
0528:
0529:            /**************************************************************************
0530:             * global permissions methods
0531:             **************************************************************************/
0532:
0533:            public boolean canLogin() {
0534:                return login;
0535:            }
0536:
0537:            public void ensureCanLogin() throws AuthenticationException {
0538:                if (login == false) {
0539:                    throw new AuthenticationException(
0540:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0541:                }
0542:            }
0543:
0544:            public boolean canAdminSystem() {
0545:                return adminSystem;
0546:            }
0547:
0548:            public void ensureCanAdminSystem() throws AuthenticationException {
0549:                if (adminSystem == false) {
0550:                    throw new AuthenticationException(
0551:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0552:                }
0553:            }
0554:
0555:            public boolean canAddForum() {
0556:                return addForum;
0557:            }
0558:
0559:            public void ensureCanAddForum() throws AuthenticationException {
0560:                if (addForum == false) {
0561:                    throw new AuthenticationException(
0562:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0563:                }
0564:            }
0565:
0566:            public boolean canAddCategory() {
0567:                return addCategory;
0568:            }
0569:
0570:            public void ensureCanAddCategory() throws AuthenticationException {
0571:                if (addCategory == false) {
0572:                    throw new AuthenticationException(
0573:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0574:                }
0575:            }
0576:
0577:            public boolean canEditCategory() {
0578:                return editCategory;
0579:            }
0580:
0581:            public void ensureCanEditCategory() throws AuthenticationException {
0582:                if (editCategory == false) {
0583:                    throw new AuthenticationException(
0584:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0585:                }
0586:            }
0587:
0588:            public boolean canDeleteCategory() {
0589:                return deleteCategory;
0590:            }
0591:
0592:            public void ensureCanDeleteCategory()
0593:                    throws AuthenticationException {
0594:                if (deleteCategory == false) {
0595:                    throw new AuthenticationException(
0596:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0597:                }
0598:            }
0599:
0600:            public boolean canSendMail() {
0601:                return sendMail;
0602:            }
0603:
0604:            public void ensureCanSendMail() throws AuthenticationException {
0605:                if (sendMail == false) {
0606:                    throw new AuthenticationException(
0607:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0608:                }
0609:            }
0610:
0611:            public boolean canModerateUser() {
0612:                return moderateUser;
0613:            }
0614:
0615:            public void ensureCanModerateUser() throws AuthenticationException {
0616:                if (moderateUser == false) {
0617:                    throw new AuthenticationException(
0618:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0619:                }
0620:            }
0621:
0622:            public boolean canUseAvatar() {
0623:                return useAvatar;
0624:            }
0625:
0626:            public void ensureCanUseAvatar() throws AuthenticationException {
0627:                if (useAvatar == false) {
0628:                    throw new AuthenticationException(
0629:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0630:                }
0631:            }
0632:
0633:            public boolean canUseMessage() {
0634:                return useMessage;
0635:            }
0636:
0637:            public void ensureCanUseMessage() throws AuthenticationException {
0638:                if (useMessage == false) {
0639:                    throw new AuthenticationException(
0640:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0641:                }
0642:            }
0643:
0644:            public boolean canAddMessageAttachment() {
0645:                return addMessageAttachment;
0646:            }
0647:
0648:            public void ensureCanAddMessageAttachment()
0649:                    throws AuthenticationException {
0650:                if (addMessageAttachment == false) {
0651:                    throw new AuthenticationException(
0652:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0653:                }
0654:            }
0655:
0656:            public boolean canUseAlbum() {
0657:                return useAlbum;
0658:            }
0659:
0660:            public void ensureCanUseAlbum() throws AuthenticationException {
0661:                if (useAlbum == false) {
0662:                    throw new AuthenticationException(
0663:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0664:                }
0665:            }
0666:
0667:            public boolean canManageOrphanPoll() {
0668:                return manageOrphanPoll;
0669:            }
0670:
0671:            public void ensureCanManageOrphanPoll()
0672:                    throws AuthenticationException {
0673:                if (canManageOrphanPoll() == false) {
0674:                    throw new AuthenticationException(
0675:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0676:                }
0677:            }
0678:
0679:            public boolean canManageAlbumItemPoll() {
0680:                return manageAlbumItemPoll;
0681:            }
0682:
0683:            public void ensureCanManageAlbumItemPoll()
0684:                    throws AuthenticationException {
0685:                if (canManageAlbumItemPoll() == false) {
0686:                    throw new AuthenticationException(
0687:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0688:                }
0689:            }
0690:
0691:            public boolean canSetPollToAnonymousType() {
0692:                return setPollToAnonymousType;
0693:            }
0694:
0695:            public void ensureCanSetPollToAnonymousType()
0696:                    throws AuthenticationException {
0697:                if (canSetPollToAnonymousType() == false) {
0698:                    throw new AuthenticationException(
0699:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0700:                }
0701:            }
0702:
0703:            /**************************************************************************
0704:             * individual forum permissions methods
0705:             **************************************************************************/
0706:            // For Forum Admin only
0707:            public boolean canEditForum(int forumID) {
0708:                return editForum.hasPermission(forumID);
0709:            }
0710:
0711:            public void ensureCanEditForum(int forumID)
0712:                    throws AuthenticationException {
0713:                if (canEditForum(forumID) == false) {
0714:                    throw new AuthenticationException(
0715:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0716:                }
0717:            }
0718:
0719:            public boolean canDeleteForum(int forumID) {
0720:                return deleteForum.hasPermission(forumID);
0721:            }
0722:
0723:            public void ensureCanDeleteForum(int forumID)
0724:                    throws AuthenticationException {
0725:                if (canDeleteForum(forumID) == false) {
0726:                    throw new AuthenticationException(
0727:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0728:                }
0729:            }
0730:
0731:            public boolean canAssignToForum(int forumID) {
0732:                return assignToForum.hasPermission(forumID);
0733:            }
0734:
0735:            public void ensureCanAssignToForum(int forumID)
0736:                    throws AuthenticationException {
0737:                if (canAssignToForum(forumID) == false) {
0738:                    throw new AuthenticationException(
0739:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0740:                }
0741:            }
0742:
0743:            // Moderator and below permission
0744:            public boolean canReadPost(int forumID) {
0745:                return readPost.hasPermission(forumID);
0746:            }
0747:
0748:            public void ensureCanReadPost(int forumID)
0749:                    throws AuthenticationException {
0750:                if (canReadPost(forumID) == false) {
0751:                    throw new AuthenticationException(
0752:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0753:                }
0754:            }
0755:
0756:            public boolean canAddThread(int forumID) {
0757:                return addThread.hasPermission(forumID);
0758:            }
0759:
0760:            public void ensureCanAddThread(int forumID)
0761:                    throws AuthenticationException {
0762:                if (canAddThread(forumID) == false) {
0763:                    throw new AuthenticationException(
0764:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0765:                }
0766:            }
0767:
0768:            public boolean canAddPost(int forumID) {
0769:                return addPost.hasPermission(forumID);
0770:            }
0771:
0772:            public void ensureCanAddPost(int forumID)
0773:                    throws AuthenticationException {
0774:                if (canAddPost(forumID) == false) {
0775:                    throw new AuthenticationException(
0776:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0777:                }
0778:            }
0779:
0780:            public boolean canEditPost(int forumID) {
0781:                return editPost.hasPermission(forumID);
0782:            }
0783:
0784:            public void ensureCanEditPost(int forumID)
0785:                    throws AuthenticationException {
0786:                if (canEditPost(forumID) == false) {
0787:                    throw new AuthenticationException(
0788:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0789:                }
0790:            }
0791:
0792:            public boolean canEditOwnPost(int forumID) {
0793:                return editOwnPost.hasPermission(forumID);
0794:            }
0795:
0796:            public void ensureCanEditOwnPost(int forumID)
0797:                    throws AuthenticationException {
0798:                if (canEditOwnPost(forumID) == false) {
0799:                    throw new AuthenticationException(
0800:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0801:                }
0802:            }
0803:
0804:            public boolean canDeletePost(int forumID) {
0805:                return deletePost.hasPermission(forumID);
0806:            }
0807:
0808:            public void ensureCanDeletePost(int forumID)
0809:                    throws AuthenticationException {
0810:                if (canDeletePost(forumID) == false) {
0811:                    throw new AuthenticationException(
0812:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0813:                }
0814:            }
0815:
0816:            public boolean canAddPoll(int forumID) {
0817:                return addPoll.hasPermission(forumID);
0818:            }
0819:
0820:            public void ensureCanAddPoll(int forumID)
0821:                    throws AuthenticationException {
0822:                if (canAddPoll(forumID) == false) {
0823:                    throw new AuthenticationException(
0824:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0825:                }
0826:            }
0827:
0828:            public boolean canAddPoll() {
0829:                return addPoll.isGlobalPermission();
0830:            }
0831:
0832:            public void ensureCanAddPoll() throws AuthenticationException {
0833:                if (canAddPoll() == false) {
0834:                    throw new AuthenticationException(
0835:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0836:                }
0837:            }
0838:
0839:            public boolean canEditPoll(int forumID) {
0840:                return editPoll.hasPermission(forumID);
0841:            }
0842:
0843:            public void ensureCanEditPoll(int forumID)
0844:                    throws AuthenticationException {
0845:                if (canEditPoll(forumID) == false) {
0846:                    throw new AuthenticationException(
0847:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0848:                }
0849:            }
0850:
0851:            public boolean canEditPoll() {
0852:                return editPoll.isGlobalPermission();
0853:            }
0854:
0855:            public void ensureCanEditPoll() throws AuthenticationException {
0856:                if (canEditPoll() == false) {
0857:                    throw new AuthenticationException(
0858:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0859:                }
0860:            }
0861:
0862:            public boolean canEditOwnPoll(int forumID) {
0863:                return editOwnPoll.hasPermission(forumID);
0864:            }
0865:
0866:            public void ensureCanEditOwnPoll(int forumID)
0867:                    throws AuthenticationException {
0868:                if (canEditOwnPoll(forumID) == false) {
0869:                    throw new AuthenticationException(
0870:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0871:                }
0872:            }
0873:
0874:            public boolean canDeletePoll(int forumID) {
0875:                return deletePoll.hasPermission(forumID);
0876:            }
0877:
0878:            public void ensureCanDeletePoll(int forumID)
0879:                    throws AuthenticationException {
0880:                if (canDeletePoll(forumID) == false) {
0881:                    throw new AuthenticationException(
0882:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0883:                }
0884:            }
0885:
0886:            public boolean canDeletePoll() {
0887:                return deletePoll.isGlobalPermission();
0888:            }
0889:
0890:            public void ensureCanDeletePoll() throws AuthenticationException {
0891:                if (canDeletePoll() == false) {
0892:                    throw new AuthenticationException(
0893:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0894:                }
0895:            }
0896:
0897:            public boolean canAddAttachment(int forumID) {
0898:                return addAttachment.hasPermission(forumID);
0899:            }
0900:
0901:            public void ensureCanAddAttachment(int forumID)
0902:                    throws AuthenticationException {
0903:                if (canAddAttachment(forumID) == false) {
0904:                    throw new AuthenticationException(
0905:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0906:                }
0907:            }
0908:
0909:            public boolean canGetAttachment(int forumID) {
0910:                return getAttachment.hasPermission(forumID);
0911:            }
0912:
0913:            public void ensureCanGetAttachment(int forumID)
0914:                    throws AuthenticationException {
0915:                if (canGetAttachment(forumID) == false) {
0916:                    throw new AuthenticationException(
0917:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0918:                }
0919:            }
0920:
0921:            public boolean canModerateThread(int forumID) {
0922:                return moderateThread.hasPermission(forumID);
0923:            }
0924:
0925:            public void ensureCanModerateThread(int forumID)
0926:                    throws AuthenticationException {
0927:                if (canModerateThread(forumID) == false) {
0928:                    throw new AuthenticationException(
0929:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0930:                }
0931:            }
0932:
0933:            /**************************************************************************
0934:             * individual forum permissions methods
0935:             **************************************************************************/
0936:            // For Forum Admin only
0937:            public boolean canEditAnyForum() {
0938:                return editForum.hasPermssionInAtLeastOneForum();
0939:            }
0940:
0941:            public void ensureCanEditAnyForum() throws AuthenticationException {
0942:                if (canEditAnyForum() == false) {
0943:                    throw new AuthenticationException(
0944:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0945:                }
0946:            }
0947:
0948:            // For moderation thread
0949:            public boolean canModerateThreadInAnyForum() {
0950:                return moderateThread.hasPermssionInAtLeastOneForum();
0951:            }
0952:
0953:            public void ensureCanModerateThreadInAnyForum()
0954:                    throws AuthenticationException {
0955:                if (canModerateThreadInAnyForum() == false) {
0956:                    throw new AuthenticationException(
0957:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0958:                }
0959:            }
0960:
0961:            public boolean canGetAttachmentInAnyForum() {
0962:                return getAttachment.hasPermssionInAtLeastOneForum();
0963:            }
0964:
0965:            public void ensureCanGetAttachmentInAnyForum()
0966:                    throws AuthenticationException {
0967:                if (canGetAttachmentInAnyForum() == false) {
0968:                    throw new AuthenticationException(
0969:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0970:                }
0971:            }
0972:
0973:            /**************************************************************************
0974:             * individual CMS permissions methods
0975:             **************************************************************************/
0976:            public boolean canAddChannel() {
0977:                return addChannel;
0978:            }
0979:
0980:            public void ensureCanAddChannel() throws AuthenticationException {
0981:                if (addChannel == false) {
0982:                    throw new AuthenticationException(
0983:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0984:                }
0985:            }
0986:
0987:            public boolean canEditChannel() {
0988:                return editChannel;
0989:            }
0990:
0991:            public void ensureCanEditChannel() throws AuthenticationException {
0992:                if (editChannel == false) {
0993:                    throw new AuthenticationException(
0994:                            NotLoginException.NOT_ENOUGH_RIGHTS);
0995:                }
0996:            }
0997:
0998:            public boolean canDeleteChannel() {
0999:                return deleteChannel;
1000:            }
1001:
1002:            public void ensureCanDeleteChannel() throws AuthenticationException {
1003:                if (deleteChannel == false) {
1004:                    throw new AuthenticationException(
1005:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1006:                }
1007:            }
1008:
1009:            public boolean canHaveRoleEditor() {
1010:                return haveRoleEditor;
1011:            }
1012:
1013:            public void ensureCanHaveRoleEditor()
1014:                    throws AuthenticationException {
1015:                if (haveRoleEditor == false) {
1016:                    throw new AuthenticationException(
1017:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1018:                }
1019:            }
1020:
1021:            public boolean canHaveRoleChiefEditor() {
1022:                return haveRoleChiefEditor;
1023:            }
1024:
1025:            public void ensureCanHaveRoleChiefEditor()
1026:                    throws AuthenticationException {
1027:                if (haveRoleChiefEditor == false) {
1028:                    throw new AuthenticationException(
1029:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1030:                }
1031:            }
1032:
1033:            public boolean canManageInfoInDay() {
1034:                return manageInfoInDay;
1035:            }
1036:
1037:            public void ensureCanManageInfoInDay()
1038:                    throws AuthenticationException {
1039:                if (manageInfoInDay == false) {
1040:                    throw new AuthenticationException(
1041:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1042:                }
1043:            }
1044:
1045:            public boolean canEditCDSLayout() {
1046:                return editCDSLayout;
1047:            }
1048:
1049:            public void ensureCanEditCDSLayout() throws AuthenticationException {
1050:                if (editCDSLayout == false) {
1051:                    throw new AuthenticationException(
1052:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1053:                }
1054:            }
1055:
1056:            /**************************************************************************
1057:             * The below methods are used to check individual Step And Channel permissions
1058:             **************************************************************************/
1059:            public boolean canWriteContent(int channelID) {
1060:                return writeContent.hasPermission(channelID);
1061:            }
1062:
1063:            public void ensureCanWriteContent(int channelID)
1064:                    throws AuthenticationException {
1065:                if (canWriteContent(channelID) == false) {
1066:                    throw new AuthenticationException(
1067:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1068:                }
1069:            }
1070:
1071:            public boolean canWriteContentInStepWithChannel(int stepID,
1072:                    int channelID) {
1073:                //TODO: notice this step
1074:                return writeContentInStepWithChannel.hasPermission(stepID,
1075:                        channelID);
1076:            }
1077:
1078:            public void ensureCanWriteContentInStepWithChannel(int stepID,
1079:                    int channelID) throws AuthenticationException {
1080:                if (canWriteContentInStepWithChannel(stepID, channelID) == false) {
1081:                    throw new AuthenticationException(
1082:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1083:                }
1084:            }
1085:
1086:            public boolean canEditContent(int channelID) {
1087:                return editContent.hasPermission(channelID);
1088:            }
1089:
1090:            public void ensureCanEditContent(int channelID)
1091:                    throws AuthenticationException {
1092:                if (canEditContent(channelID) == false) {
1093:                    throw new AuthenticationException(
1094:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1095:                }
1096:            }
1097:
1098:            //---------------------------------------------------------------------
1099:            public boolean canEditContentInStepWithChannel(int stepID,
1100:                    int channelID) {
1101:                return editContentInStepWithChannel.hasPermission(stepID,
1102:                        channelID);
1103:            }
1104:
1105:            public void ensureCanEditContentInStepWithChannel(int stepID,
1106:                    int channelID) throws AuthenticationException {
1107:                if (canEditContentInStepWithChannel(stepID, channelID) == false) {
1108:                    throw new AuthenticationException(
1109:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1110:                }
1111:            }
1112:
1113:            public boolean canApproveContent(int channelID) {
1114:                return approveContent.hasPermission(channelID);
1115:            }
1116:
1117:            public void ensureCanApproveContent(int channelID)
1118:                    throws AuthenticationException {
1119:                if (canApproveContent(channelID) == false) {
1120:                    throw new AuthenticationException(
1121:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1122:                }
1123:            }
1124:
1125:            public boolean canPublishContent(int channelID) {
1126:                return publishContent.hasPermission(channelID);
1127:            }
1128:
1129:            public void ensureCanPublishContent(int channelID)
1130:                    throws AuthenticationException {
1131:                if (canPublishContent(channelID) == false) {
1132:                    throw new AuthenticationException(
1133:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1134:                }
1135:            }
1136:
1137:            public boolean canDeleteContent(int channelID) {
1138:                return deleteContent.hasPermission(channelID);
1139:            }
1140:
1141:            public void ensureCanDeleteContent(int channelID)
1142:                    throws AuthenticationException {
1143:                if (canDeleteContent(channelID) == false) {
1144:                    throw new AuthenticationException(
1145:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1146:                }
1147:            }
1148:
1149:            //---------------------------------------------------------------------
1150:            public boolean canDeleteContentInStepWithChannel(int stepID,
1151:                    int channelID) {
1152:                return deleteContentInStepWithChannel.hasPermission(stepID,
1153:                        channelID);
1154:            }
1155:
1156:            public void ensureCanDeleteContentInStepWithChannel(int stepID,
1157:                    int channelID) throws AuthenticationException {
1158:                if (canDeleteContentInStepWithChannel(stepID, channelID) == false) {
1159:                    throw new AuthenticationException(
1160:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1161:                }
1162:            }
1163:
1164:            public boolean canViewContentInStepWithChannel(int stepID,
1165:                    int channelID) {
1166:                return viewContentInStepWithChannel.hasPermission(stepID,
1167:                        channelID);
1168:            }
1169:
1170:            public void ensureCanViewContentInStepWithChannel(int stepID,
1171:                    int channelID) throws AuthenticationException {
1172:                if (canViewContentInStepWithChannel(stepID, channelID) == false) {
1173:                    throw new AuthenticationException(
1174:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1175:                }
1176:            }
1177:
1178:            public boolean canViewContentStepWithAnyChannel(int stepID) {
1179:                return viewContentStepWithChannel
1180:                        .hasPermssionInStepInAtLeastOneChannel(stepID);
1181:            }
1182:
1183:            public void ensureCanViewContentStepWithAnyChannel(int stepID)
1184:                    throws AuthenticationException {
1185:                if (canViewContentStepWithAnyChannel(stepID) == false) {
1186:                    throw new AuthenticationException(
1187:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1188:                }
1189:            }
1190:
1191:            public boolean canViewContentStepWithChannel(int stepID,
1192:                    int channelID) {
1193:                return viewContentStepWithChannel.hasPermission(stepID,
1194:                        channelID);
1195:            }
1196:
1197:            public void ensureCanViewContentStepWithChannel(int stepID,
1198:                    int channelID) throws AuthenticationException {
1199:                if (canViewContentStepWithChannel(stepID, channelID) == false) {
1200:                    throw new AuthenticationException(
1201:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1202:                }
1203:            }
1204:
1205:            public boolean canGoToContentStepWithChannel(int stepID,
1206:                    int channelID) {
1207:                return goToContentStepWithChannel.hasPermission(stepID,
1208:                        channelID);
1209:            }
1210:
1211:            public void ensureCanGoToContentStepWithChannel(int stepID,
1212:                    int channelID) throws AuthenticationException {
1213:                if (canGoToContentStepWithChannel(stepID, channelID) == false) {
1214:                    throw new AuthenticationException(
1215:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1216:                }
1217:            }
1218:
1219:            public boolean canDeployContentInStepWithChannel(int stepID,
1220:                    int channelID) {
1221:                return deployContentInStepWithChannel.hasPermission(stepID,
1222:                        channelID);
1223:            }
1224:
1225:            public void ensureCanDeployContentInStepWithChannel(int stepID,
1226:                    int channelID) throws AuthenticationException {
1227:                if (canDeployContentInStepWithChannel(stepID, channelID) == false) {
1228:                    throw new AuthenticationException(
1229:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1230:                }
1231:            }
1232:
1233:            /**************************************************************************
1234:             * individual CHANNEL permissions methods
1235:             **************************************************************************/
1236:            public boolean canWriteContentInAnyChannel() {
1237:                return writeContent.hasPermssionInAnyChannels();
1238:            }
1239:
1240:            public void ensureCanWriteContentInAnyChannel()
1241:                    throws AuthenticationException {
1242:                if (canWriteContentInAnyChannel() == false) {
1243:                    throw new AuthenticationException(
1244:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1245:                }
1246:            }
1247:
1248:            public boolean canWriteContentInAnyChannelWithAnyStep() {
1249:                return writeContentInStepWithChannel
1250:                        .hasPermssionInAtLeastOneChannelOrStep();
1251:            }
1252:
1253:            public void ensureCanWriteContentInAnyChannelWithAnyStep()
1254:                    throws AuthenticationException {
1255:                if (canWriteContentInAnyChannelWithAnyStep() == false) {
1256:                    throw new AuthenticationException(
1257:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1258:                }
1259:            }
1260:
1261:            public boolean canEditContentInAnyChannel() {
1262:                return editContentInStepWithChannel
1263:                        .hasPermssionInAtLeastOneChannelOrStep();
1264:            }
1265:
1266:            public void ensureCanEditContentInAnyChannel()
1267:                    throws AuthenticationException {
1268:                if (canEditContentInAnyChannel() == false) {
1269:                    throw new AuthenticationException(
1270:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1271:                }
1272:            }
1273:
1274:            public boolean canApproveContentInAnyChannel() {
1275:                return approveContent.hasPermssionInAnyChannels();
1276:            }
1277:
1278:            public void ensureCanApproveContentInAnyChannel()
1279:                    throws AuthenticationException {
1280:                if (canApproveContentInAnyChannel() == false) {
1281:                    throw new AuthenticationException(
1282:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1283:                }
1284:            }
1285:
1286:            public boolean canPublishContentInAnyChannel() {
1287:                return publishContent.hasPermssionInAnyChannels();
1288:            }
1289:
1290:            public void ensureCanPublishContentInAnyChannel()
1291:                    throws AuthenticationException {
1292:                if (canPublishContentInAnyChannel() == false) {
1293:                    throw new AuthenticationException(
1294:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1295:                }
1296:            }
1297:
1298:            public boolean canDeployContentWithStepInAnyChannel(int stepID) {
1299:                return deployContentInStepWithChannel
1300:                        .hasPermssionInStepInAtLeastOneChannel(stepID);
1301:            }
1302:
1303:            public void ensureCanDeployContentWithStepInAnyChannel(int stepID)
1304:                    throws AuthenticationException {
1305:                if (canDeployContentWithStepInAnyChannel(stepID) == false) {
1306:                    throw new AuthenticationException(
1307:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1308:                }
1309:            }
1310:
1311:            public boolean canViewAnyContentStep() {
1312:                return viewContentStepWithChannel
1313:                        .hasPermssionInAtLeastOneChannelOrStep();
1314:            }
1315:
1316:            public void ensureCanViewAnyContentStep()
1317:                    throws AuthenticationException {
1318:                if (canViewAnyContentStep() == false) {
1319:                    throw new AuthenticationException(
1320:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1321:                }
1322:            }
1323:
1324:            /**************************************************************************
1325:             * The below methods are used to check global Ads permissions
1326:             **************************************************************************/
1327:
1328:            public boolean canManageAds() {
1329:                return manageAds;
1330:            }
1331:
1332:            public void ensureCanManageAds() throws AuthenticationException {
1333:                if (manageAds == false) {
1334:                    throw new AuthenticationException(
1335:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1336:                }
1337:            }
1338:
1339:            public boolean canAddZone() {
1340:                return addZone;
1341:            }
1342:
1343:            public void ensureCanAddZone() throws AuthenticationException {
1344:                if (addZone == false) {
1345:                    throw new AuthenticationException(
1346:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1347:                }
1348:            }
1349:
1350:            public boolean canEditZone() {
1351:                return editZone;
1352:            }
1353:
1354:            public void ensureCanEditZone() throws AuthenticationException {
1355:                if (editZone == false) {
1356:                    throw new AuthenticationException(
1357:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1358:                }
1359:            }
1360:
1361:            public boolean canDeleteZone() {
1362:                return deleteZone;
1363:            }
1364:
1365:            public void ensureCanDeleteZone() throws AuthenticationException {
1366:                if (deleteZone == false) {
1367:                    throw new AuthenticationException(
1368:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1369:                }
1370:            }
1371:
1372:            public boolean canAddBanner() {
1373:                return addBanner;
1374:            }
1375:
1376:            public void ensureCanAddBanner() throws AuthenticationException {
1377:                if (addBanner == false) {
1378:                    throw new AuthenticationException(
1379:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1380:                }
1381:            }
1382:
1383:            public boolean canEditBanner() {
1384:                return editBanner;
1385:            }
1386:
1387:            public void ensureCanEditBanner() throws AuthenticationException {
1388:                if (editBanner == false) {
1389:                    throw new AuthenticationException(
1390:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1391:                }
1392:            }
1393:
1394:            public boolean canDeleteBanner() {
1395:                return deleteBanner;
1396:            }
1397:
1398:            public void ensureCanDeleteBanner() throws AuthenticationException {
1399:                if (deleteBanner == false) {
1400:                    throw new AuthenticationException(
1401:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1402:                }
1403:            }
1404:
1405:            public boolean canViewZone() {
1406:                return viewZone;
1407:            }
1408:
1409:            public void ensureCanViewZone() throws AuthenticationException {
1410:                if (viewZone == false) {
1411:                    throw new AuthenticationException(
1412:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1413:                }
1414:            }
1415:
1416:            public boolean canViewBanner() {
1417:                return viewBanner;
1418:            }
1419:
1420:            public void ensureCanViewBanner() throws AuthenticationException {
1421:                if (viewBanner == false) {
1422:                    throw new AuthenticationException(
1423:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1424:                }
1425:            }
1426:
1427:            public boolean canUploadMedia() {
1428:                return uploadMedia;
1429:            }
1430:
1431:            public void ensureCanUploadMedia() throws AuthenticationException {
1432:                if (uploadMedia == false) {
1433:                    throw new AuthenticationException(
1434:                            NotLoginException.NOT_ENOUGH_RIGHTS);
1435:                }
1436:            }
1437:
1438:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.