Activiti - 权限视图

-- 使用 用户/角色 > code 去作为activiti的权限表
DROP VIEW  IF EXISTS act_id_membership;
DROP VIEW  IF EXISTS act_id_user;
DROP VIEW  IF EXISTS act_id_group;

CREATE VIEW act_id_user AS 
SELECT
  au.login_name AS ID_,
  NULL          AS REV_,
  concat('first_',au.login_name)   AS FIRST_,
  concat('last_',au.login_name) AS LAST_,
  au.email      AS EMAIL_,
  au.PASSWORD   AS PWD_,
  NULL         AS PICTURE_ID_
FROM acct_user au;

CREATE VIEW act_id_group 
AS
SELECT ar.CODE AS ID_,NULL AS REV_,ar.NAME AS NAME_,NULL AS TYPE_ FROM acct_role ar;

CREATE VIEW act_id_membership
AS
SELECT (SELECT u.login_name FROM acct_user u WHERE u.id=ur.user_id) AS USER_ID_,(SELECT r.code FROM acct_role r WHERE r.id=ur.role_id) AS GROUP_ID_ FROM acct_user_role ur;


-- 以下代码不能用是因为 不能用ID,而应用user/role的code去查询
-- CREATE VIEW act_id_membership AS SELECT user_id AS USER_ID_,role_id AS GROUP_ID_ FROM acct_user_role;
-- CREATE VIEW act_id_group AS SELECT id AS ID_,1 AS REV_,NAME AS NAME_,CODE AS TYPE_ FROM acct_role;
-- CREATE VIEW act_id_user AS SELECT id AS ID_,1 AS REV_,nickname AS FIRST_,login_name AS LAST_,email AS EMAIL_,PASSWORD AS PWD_,'' AS PICTURE_ID_ FROM acct_user;

 

Activiti的 act_id_info 为 Activiti 的id维护表,若使用 视图维护 Activiti的 权限,则删除act_id_info  表即可,且注意Activiti的权限自增主键策略设置为 false;

 

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
		<!-- 是否使用权限表的自动ID生成 -->
		<property name="isDbIdentityUsed" value="false"/>

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值