Cognos权限Custom Java Provider表结构实例

浏览: 1906

select * from org_user;
USER_ID USER_CODE USER_NAME FULL_NAME EMAIL PWD
2 889 zhangsan 张三 123@126.com 000000
1 888 king 国王 123@126.com 000000
3 890 lisi 李四 123@126.com 000000

select * from org_role;
ROLE_ID ROLE_CODE ROLE_NAME SORT SUMMARY
10000 admin 管理员 1000
10001 boss 总经理

select * from org_user_role

USER_ID ROLE_ID USER_NAME ROLE_CODE
1 10000 king admin
2 10001 zhangsan boss

--插入新用户
insert into org_user(user_id,user_code,user_name,full_name,email,pwd)
select max(user_id)+1,max(user_code)+1,'lisi','李四','123@126.com','000000' from org_user
--插入新角色
insert into org_role(role_id,role_code,role_name) select max(role_id)+1,'boss','总经理' from org_role
--给用户赋权

PS:给用户张三赋权为总经理角色
insert into org_user_role(user_id,role_id,user_name,role_code)
select u.user_id,r.role_id,u.user_name,r.role_code from org_user u,org_role r where u.full_name='张三'
and r.role_name='总经理'

PS:需要注意的地方

1:亮蓝色表示的是三个表的名字,即用户表,角色表,用户角色配置表

2:亮红色表示必须字段,根据不用数据库类型自行设计表结构

3:内附恢复匿名用户管理员权限脚本(Oracle)

insert into CMREFORD1 (PROPID, CMID, ORD, REFCMID) select 27, (select cmid from cmobjprops1 where upper(objid)='::SYSTEM ADMINISTRATORS'),coalesce((select max(ord) from CMREFORD1 where cmid=(select cmid from cmobjprops1 where upper(objid)='::SYSTEM ADMINISTRATORS')), -1)+1, CMID from CMOBJPROPS1 where upper(OBJID)='::EVERYONE';
commit;

推荐 0
本文由 kingwang 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。

0 个评论

要回复文章请先登录注册