📄 mvnforumpermissionimpl.java
字号:
/*
* $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/auth/MVNForumPermissionImpl.java,v 1.5 2004/05/29 18:47:06 minhnn Exp $
* $Author: minhnn $
* $Revision: 1.5 $
* $Date: 2004/05/29 18:47:06 $
*
* ====================================================================
*
* Copyright (C) 2002-2004 by MyVietnam.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* All copyright notices regarding mvnForum MUST remain intact
* in the scripts and in the outputted HTML.
* The "powered by" text/logo with a link back to
* http://www.mvnForum.com and http://www.MyVietnam.net in the
* footer of the pages MUST remain visible when the pages
* are viewed on the internet or intranet.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Support can be obtained from support forums at:
* http://www.mvnForum.com/mvnforum/index
*
* Correspondence and Marketing Questions can be sent to:
* info@MyVietnam.net
*
* @author: Minh Nguyen minhnn@MyVietnam.net
* @author: Mai Nguyen mai.nh@MyVietnam.net
*/
package com.mvnforum.auth;
import net.myvietnam.mvncore.exception.AssertionException;
/**
* This class is private in the package
*/
class MVNForumPermissionImpl extends AbstractPermission implements MVNForumPermission {
MVNForumPermissionImpl() {
}
private void setBypassPrivateForum(boolean bypass) {
editForum.setBypassPrivateForum(bypass);
deleteForum.setBypassPrivateForum(bypass);
assignToForum.setBypassPrivateForum(bypass);
readPost.setBypassPrivateForum(bypass);
addThread.setBypassPrivateForum(bypass);
addPost.setBypassPrivateForum(bypass);
editPost.setBypassPrivateForum(bypass);
deletePost.setBypassPrivateForum(bypass);
addPoll.setBypassPrivateForum(bypass);
editPoll.setBypassPrivateForum(bypass);
deletePoll.setBypassPrivateForum(bypass);
addAttachment.setBypassPrivateForum(bypass);
getAttachment.setBypassPrivateForum(bypass);
moderateThread.setBypassPrivateForum(bypass);
}
/**
* The ONLY way to set permission, so this MUST have default package access
*/
void setPermission(int permission) throws AssertionException {
switch (permission) {
case PERMISSION_AUTHENTICATED:
authenticated = true;
break;
case PERMISSION_ACTIVATED:
activated = true;
break;
/**************************************************************************
* Combined permissions, range from 100 to 199
* A permission in this range is the combination of other permissions
**************************************************************************/
case PERMISSION_SYSTEM_ADMIN:
adminSystem = true;
addForum = true;
editForum.setAllForumsPermission(true);
deleteForum.setAllForumsPermission(true);
assignToForum.setAllForumsPermission(true);
addCategory = true;
editCategory = true;
deleteCategory = true;
sendMail = true;
useAvatar = true;
useMessage = true;
readPost.setAllForumsPermission(true);
addThread.setAllForumsPermission(true);
addPost.setAllForumsPermission(true);
editPost.setAllForumsPermission(true);
deletePost.setAllForumsPermission(true);
addPoll.setAllForumsPermission(true);
editPoll.setAllForumsPermission(true);
deletePoll.setAllForumsPermission(true);
addAttachment.setAllForumsPermission(true);
getAttachment.setAllForumsPermission(true);
moderateThread.setAllForumsPermission(true);
setBypassPrivateForum(true);
break;
case PERMISSION_FORUM_ADMIN:
addForum = true;
editForum.setAllForumsPermission(true);
deleteForum.setAllForumsPermission(true);
assignToForum.setAllForumsPermission(true);
addCategory = true;
editCategory = true;
deleteCategory = true;
readPost.setAllForumsPermission(true);
addThread.setAllForumsPermission(true);
addPost.setAllForumsPermission(true);
editPost.setAllForumsPermission(true);
deletePost.setAllForumsPermission(true);
addPoll.setAllForumsPermission(true);
editPoll.setAllForumsPermission(true);
deletePoll.setAllForumsPermission(true);
addAttachment.setAllForumsPermission(true);
getAttachment.setAllForumsPermission(true);
moderateThread.setAllForumsPermission(true);
break;
case PERMISSION_FORUM_MODERATOR:
editForum.setAllForumsPermission(true);
editCategory = true;
readPost.setAllForumsPermission(true);
addThread.setAllForumsPermission(true);
addPost.setAllForumsPermission(true);
editPost.setAllForumsPermission(true);
deletePost.setAllForumsPermission(true);
addPoll.setAllForumsPermission(true);
editPoll.setAllForumsPermission(true);
deletePoll.setAllForumsPermission(true);
addAttachment.setAllForumsPermission(true);
getAttachment.setAllForumsPermission(true);
moderateThread.setAllForumsPermission(true);
break;
case PERMISSION_LIMITED_USER:
readPost.setAllForumsPermission(true);
/** @todo at the 1.0.0 beta2/beta3/RC1/RC2 release, add post is disable*/
// addPost = true;
break;
case PERMISSION_NORMAL_USER:
useAvatar = true;
useMessage = true;
readPost.setAllForumsPermission(true);
addThread.setAllForumsPermission(true);
addPost.setAllForumsPermission(true);
getAttachment.setAllForumsPermission(true);
break;
/**
* Can:
* - login, read thread and post, reply to a thread
* - add thread, use avatar, use private message, get attachment
* - use attachment, create poll
*/
case PERMISSION_POWER_USER:
useAvatar = true;
useMessage = true;
readPost.setAllForumsPermission(true);
addThread.setAllForumsPermission(true);
addPost.setAllForumsPermission(true);
addPoll.setAllForumsPermission(true);
addAttachment.setAllForumsPermission(true);
getAttachment.setAllForumsPermission(true);
break;
/**************************************************************************
* Individual Permissions for global usages, range from 1000 to 2000
**************************************************************************/
case PERMISSION_LOGIN:
login = true;
break;
//case PERMISSION_ADMIN_SYSTEM:
// adminSystem = true;
// break;
case PERMISSION_ADD_FORUM:
addForum = true;
break;
case PERMISSION_ADD_CATEGORY:
addCategory = true;
break;
case PERMISSION_EDIT_CATEGORY:
editCategory = true;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -