矩陣結構的數(shù)據(jù)庫設計:
?
組織結構表?(單位ID,部門ID,上級部門ID,...)
用戶表(單位ID,部門ID,用戶ID,用戶名稱,口令...)
組織結構關系表(部門ID,用戶ID)
?
上述表中如何體現(xiàn)矩陣型的組織結構?在用戶表中有一個部門ID,關聯(lián)組織結構表的部門ID,這樣部門和用戶是一對多的,即一個行政部門有多個用戶,一個用戶只能屬于一個行政部門;
利用組織結構表和組織結構關系表可建立多對多的組織結構-人員關系,這樣用戶除了屬于一個行政部門外,如果要體現(xiàn)兼職,或者屬于多個群組,可利用此表存儲多對多關系.這樣即有組織結構表反映垂直的組織結構關系,又可利用組織結構-人員多對多關系建立任意的關聯(lián).
在使用了Spring Security的權限框架的系統(tǒng)中,一個完整的用戶權限集合是:
用戶-權限+用戶-角色-權限+用戶按行政部門的組織結構權限+用戶按群組(即多對多的組織結構)劃分獲得的權限,在openjweb中實現(xià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為權限基本信息表;
comm_user_auth為用戶權限關系表
comm_user_role為用戶角色關系表
comm_role_auth為角色權限關系表
comm_roles為角色表
comm_org_emp_rel為組織結構人員關系表(即多對多關系表)
comm_dept_auth為組織結構權限表
comm_dept為組織結構基本信息表
?
目前openjweb已經(jīng)實現(xiàn)了用戶,角色,權限,組織結構基本信息錄入及用戶-權限,用戶-角色關聯(lián),角色授權,組織結構-人員多對多維護,組織結構授權等功能,形成了一個完整的權限管理解決方案.
OpenJWeb 1.6版本Java快速開發(fā)平臺矩陣組織結構及Spring Security權限實現(xiàn)方法
更多文章、技術交流、商務合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
