怎样进行权限培植和动态分配权限?

初步设想为:新加用户时,生成数据权限;在操作时,按照权限进行。
将用户号码转为14位的二进制数,并分为5个部分(等级)。
我想请教一下:
1。怎么把十进制的用户名与十进制的位置代码对应起来?‘
初步设想是:
(1)用一个14位的二进制与一个4位的十进制用户登陆号码相对应。用户登陆时获得相应的二进制数字串。
(2)写代码将二进制数字串转为十进制的数字串,并插入表中。
问题就是:怎样把用户登陆号与二进制数字传对应起来?还有怎样把二进制数字传转为十进制?希望有具体的代码给我看看啊。^_^
2。怎样动态的把用户名与相应权限对应起来?
也想过,在用户有需求时手动添加用户名以及相应权限,但是数量大和时间紧迫的情况下是很难做到的
那么,怎么能做到新增一个用户名时能够自动赋予其相应的权限呢?

第一次设置权限,就想这么点吧,希望高手帮忙,欢迎讨论。

怎么没人理我,自己顶一个!

What you need is dynamically set the user-role.

1. You must set up serveral tables in the database
let's say,


User <---1:n--> user-role <---n:1--> Role <1:n> role-operation <n:1> operation

2. Provide interface so that syyAdmin can update the data in these tables.

3. Before the proceeding the operation, check the user's roles and screen the operation authority .