jforum 二次开发 权限系统
来源:互联网 发布:开网店天猫好还是淘宝好 编辑:程序博客网 时间:2024/03/29 22:49
http://cid-5d1295892cb8e3ee.spaces.live.com/blog/cns!5D1295892CB8E3EE!340.entry
刚刚看到jforum的ER图还真有点奇怪,从ER图上看,jforum是使用group和role来管理权限,但是只有gorup和user有关联关系,
竟然和forum没有关联关系,后来才明白是在jforum_role_values这张表里,把forumId作为role_value字段保存了,估计设计者
也是为了简少表之间的外键关联关系。
jforum里对权限分得很细,大体有一下几种:
perm_category 限制的分类
perm_forum 限制的版块
perm_anonymous_post 禁止匿名用户发帖
perm_reply_only 禁止发主体帖,允许回复帖子
perm_create_sticky_announcement_topics$single 允许将主题设置为公告或置顶主题
perm_create_poll$single 可发起投票帖
perm_vote$single 允许投票
perm_read_only_forums 只读版块.选择允许所有表示禁止标签,也就是可回复。
perm_reply_without_moderation 选择 '允许全部'将不限制对所有版块的回复,选中指定的版块代表不允许在选择的版本中回复信息.
perm_html_disabled 选中的版块代表不允许使用HTML标签 .选择‘允许所有’代表允许所有版面使用HTML标签
perm_karma_enabled$single 使用文章评分
perm_bookmarks_enabled$single 允许使用书签
perm_attachments_enabled 是否允许使用附件,选择'允许全部'代表可以使用,选择指定版块代表不允许在选中的版块中使用附件
perm_attachments_download 允许下载附件
perm_moderation_log$single 可以查阅管理活动日志
perm_full_moderation_log$single 可以查阅完整的管理活动日志
perm_moderation$single 是否允许设置为版主
perm_moderation_approve_messages$single 是否在允许的版块里审核/封锁贴子
perm_moderation_forums 不能修改的论坛
perm_moderation_post_remove$single 删除贴子
perm_moderation_post_edit$single 修改贴子
perm_moderation_topic_move$single 移动贴子
perm_moderation_topic_lockUnlock$single 锁定和解锁主题
通过不同的组合可以定义不同的group,不过最终的权限(role),只能分配给gorup,然后把用户加入不同的group来获得role.
(在jforum的管理界面看到group有层次关系,可以有parent,也激动了下,难道group的role也可以继承?后来实验了下发现并没有
这样的机制~。~ 不过一个用户可以属于不同的gorup,role是全部gorup的合集,通过这个还是可以做些文章的 ^.^ )
是JDBC,所以想要进行二次开发还是得花点力气的。但是jforum的代码比较好读,处处都有封装,虽然注释不多,看懂代码还是比较简单的。
这样使用起来比较方便:
添加一个权限:
GroupAction >>
添加权限控制为group控制 permissionsSave
GroupSecurityDAO gmodel = DataAccessDriver.getInstance().newGroupSecurityDAO(); (提示使用gorup管理,看来以后还有扩展)
PermissionControl pc = new PermissionControl();
pc.setSecurityModel(gmodel);
role.setName(paramName);
this.pc.addRole(this.groupId, role, roleValues); 》》》 pc = PermissionControl
GroupAction >> insertSave
UserAction 》》 groupsSave
GenericUserDAO 》》 addToGroup
ForumAction >> insertSave
int[] gorupIds) {
this.addRole(pc, SecurityConstants.PERM_MODERATION_LOG, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_FULL_MODERATION_LOG, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_MODERATION, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_MODERATION_APPROVE_MESSAGES, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_MODERATION_POST_REMOVE, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_MODERATION_POST_EDIT, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_MODERATION_TOPIC_MOVE, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_MODERATION_TOPIC_LOCK_UNLOCK, f.getId(), gorupIds);
//------manager role
}
int[] gorupIds) {
this.addRole(pc, SecurityConstants.PERM_ANONYMOUS_POST, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_REPLY_ONLY, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_CREATE_STICKY_ANNOUNCEMENT_TOPICS, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_CREATE_POLL, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_VOTE, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_BOOKMARKS_ENABLED, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_ATTACHMENTS_ENABLED, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_ATTACHMENTS_DOWNLOAD, f.getId(), gorupIds);
this.addRole(pc, SecurityConstants.PERM_ATTACHMENTS_DOWNLOAD, f.getId(), gorupIds);
}
- jforum 二次开发 权限系统
- 【jforum二次开发】(1)
- jforum二次开发中的中文问题
- jforum二次开发——添加内容过滤
- jforum二次开发中常见问题及解决方法
- JForum
- jforum
- Jforum二次开发中遇到的问题与解决
- jforum二次开发相关笔记——页面请求机制
- 搭建开源论坛JForum的二次开发环境
- Java开源论坛JForum二次开发技术资料之源码导入安装
- jforum二次开发相关笔记——(一)页面请求机制
- sharepoint视图权限控制器二次开发
- 微米系统二次开发记录
- Epicor系统二次开发
- phpcms二次开发之采集系统
- REVIT二次开发 系统错误处理
- 续“SunshineCRM系统”二次开发总结
- Android 平台如何传值 绝对让你看明白
- C#读写日志文本文件
- scratchbox中编译busybox流程
- PKU 3702 Chessman
- event.keycode大全(javascript)
- jforum 二次开发 权限系统
- 用字符串的length实现限制文本框长度
- 有关“完成端口”
- brk和sbrk及内存分配函数相关
- IE8里Jquery删除表格行的问题
- 使用Apache架设代理服务器
- 关于ActiveMQ消息接收的问题
- Oracle经典问答一览
- 无限免费短信任你发--飞信3.5版