关于将模块分配给角色 [英] Regarding assignment of modules to Roles

查看:86
本文介绍了关于将模块分配给角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好每一个..





如果我有10个模块假设我需要将10个模块中的8个分配给经理角色和2个模块对教师的作用..

我该如何分配它们?任何设计理念请..





谢谢...

解决方案



我假设你是指数据库设计。

存储在单独数据中的简单方法

1.你有一张桌子模块

2.另一个角色表

3.创建新表,它将存储模块和角色的主键......这样你就可以创建灵活的解决方案你可以在以后的日期更改


1)你的Module表应该有ModulePageID。

2)创建一个像''checkuseraccess(pageid)'这样的常用函数应该从每个页面调用onload。

3)登录后获取roleid并从db获取该角色的所有模块进行一些连接。

4)之后所有模块的商店一些全局变量中的名称,如javascript中的sessvars。

5)为所有模块执行循环,并显示基于从db恢复的pageid的所需页面。(默认情况下)你的所有页面都应该隐藏起来。

6)在所有页面加载调用''checkuseraccess(pageid)''页码id你从db传递中作为参数重新检入并检入全局变量是否存在。 / BLOCKQUOTE>

Hello Every one..


If i have 10 modules for suppose i need to assign 8 out of 10 modules to manager role and 2modules to teacher role..
how can i assign them? any design idea please..


Thanks...

解决方案

Hi,
I assume that you are referring database designs.
Simple way to store in a separate datable
1.you have one table with modules
2.Another table with Roles
3.Create new table which will stores primary keys of Module and Role... in this way you can create flexible solution which you van change on later date


1) You Module table should have ModulePageID.
2) create a common function like ''checkuseraccess(pageid)'' which should call from each page onload.
3) After login take roleid and get all modules for that role from db doing some joins.
4) after that store that all modules names in some global variable like sessvars in javascript.
5) do for loop for all modules and show only wanted pages based on pageid retrevied from db.(by default your all pages should be hide).
6) On all page load call ''checkuseraccess(pageid)'' with page id you reterive from db pass as parmeter and check in global variable for existence.


这篇关于关于将模块分配给角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆