矩陣結(jié)構(gòu)的數(shù)據(jù)庫設(shè)計(jì):
?
組織結(jié)構(gòu)表?(單位ID,部門ID,上級部門ID,...)
用戶表(單位ID,部門ID,用戶ID,用戶名稱,口令...)
組織結(jié)構(gòu)關(guān)系表(部門ID,用戶ID)
?
上述表中如何體現(xiàn)矩陣型的組織結(jié)構(gòu)?在用戶表中有一個部門ID,關(guān)聯(lián)組織結(jié)構(gòu)表的部門ID,這樣部門和用戶是一對多的,即一個行政部門有多個用戶,一個用戶只能屬于一個行政部門;
利用組織結(jié)構(gòu)表和組織結(jié)構(gòu)關(guān)系表可建立多對多的組織結(jié)構(gòu)-人員關(guān)系,這樣用戶除了屬于一個行政部門外,如果要體現(xiàn)兼職,或者屬于多個群組,可利用此表存儲多對多關(guān)系.這樣即有組織結(jié)構(gòu)表反映垂直的組織結(jié)構(gòu)關(guān)系,又可利用組織結(jié)構(gòu)-人員多對多關(guān)系建立任意的關(guān)聯(lián).
在使用了Spring Security的權(quán)限框架的系統(tǒng)中,一個完整的用戶權(quán)限集合是:
用戶-權(quán)限+用戶-角色-權(quán)限+用戶按行政部門的組織結(jié)構(gòu)權(quán)限+用戶按群組(即多對多的組織結(jié)構(gòu))劃分獲得的權(quán)限,在openjweb中實(shí)現(xiàn)了所有上述權(quán)限,其數(shù)據(jù)庫的視圖參考如下:
?
create or replace view v_user_auth as
select a.user_id,a.login_id,b.comm_code,b.auth_name,b.auth_resource from
comm_user a,comm_auth b ,comm_user_auth c
where c.user_id = a.user_id
and c.auth_id = b.auth_id
union
select a.user_id,a.login_id,b.comm_code,b.auth_name,b.auth_resource from
comm_user a,comm_auth b , comm_user_role d,comm_role_auth e
where a.user_id = d.user_id
and d.role_id = e.role_id
and e.auth_id = b.auth_id
union
select distinct a.user_id,a.login_id,b.comm_code,b.auth_name,b.auth_resource from
comm_user a,comm_auth b , comm_org_emp_rel d,comm_dept_auth e
where a.user_id = d.user_id
and d.org_id = e.dept_id
and e.auth_id = b.auth_id
union
select distinct a.user_id,a.login_id,b.comm_code,b.auth_name,b.auth_resource from
comm_user a,comm_auth b ,comm_dept d ,comm_dept_auth e
where a.dept_id = d.pk_id
and d.row_id = e.dept_id
and e.auth_id = b.auth_id;
?
說明:comm_auth為權(quán)限基本信息表;
comm_user_auth為用戶權(quán)限關(guān)系表
comm_user_role為用戶角色關(guān)系表
comm_role_auth為角色權(quán)限關(guān)系表
comm_roles為角色表
comm_org_emp_rel為組織結(jié)構(gòu)人員關(guān)系表(即多對多關(guān)系表)
comm_dept_auth為組織結(jié)構(gòu)權(quán)限表
comm_dept為組織結(jié)構(gòu)基本信息表
?
目前openjweb已經(jīng)實(shí)現(xiàn)了用戶,角色,權(quán)限,組織結(jié)構(gòu)基本信息錄入及用戶-權(quán)限,用戶-角色關(guān)聯(lián),角色授權(quán),組織結(jié)構(gòu)-人員多對多維護(hù),組織結(jié)構(gòu)授權(quán)等功能,形成了一個完整的權(quán)限管理解決方案.
OpenJWeb 1.6版本Java快速開發(fā)平臺矩陣組織結(jié)構(gòu)及Spring Security權(quán)限實(shí)現(xiàn)方法
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元

