OpenJWeb快速开发平台组织结构继承权限的实现

OpenJWeb快速开发平台中实现了上级组织结构下的人员可获得下级组织结构的权限,sql:

create or replace view v_user_auth as
--select distinct user_id,login_id,comm_code,auth_name,auth_resource from (
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 a.user_id,a.login_id,b.comm_code,b.auth_name,b.auth_resource from (
select a.user_id,a.login_id,b.row_id row_id,b.tree_code from comm_user a,comm_dept b where a.dept_id=b.pk_id union
select a.user_id,c.login_id,a.org_id row_id,b.tree_code from comm_org_emp_rel a,comm_dept b,comm_user c where b.row_id = a.org_id and c.dept_id=b.pk_id) a,
(
select a.dept_id,c.auth_id,b.tree_code,c.comm_code ,c.auth_name,c.auth_resource from comm_dept_auth a,comm_dept b,comm_auth c where a.dept_id =b.row_id
and a.auth_id=c.auth_id) b
where  b.tree_code like a.tree_code ||'%'  ;

例如下级组织结构001001具有某功能的权限,则上级组织结构001则可获得此功能的权限,如果用户A属于001部门,则

此用户可获得分配给001001组织的权限.使用spring security框架可以从这个视图中获取权限记录.

你可能感兴趣的:(开发平台)