加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql9.6中的 Row Security Policies

发布时间:2020-12-13 17:01:24 所属栏目:百科 来源:网络整理
导读:1.。中文VS2008下面编译pg9.6 修改VSObjectFactory.pm 中的 DetermineVisualStudioVersion 直接return '9.00'; 2.。在 ALTER TABLE accounts ENABLE ROW LEVEL SECURITY;时 a ) 在函数 ATExecEnableRowSecurity 把pg_class中的 relrowsecurity 置为 true 3。

1.。中文VS2008下面编译pg9.6

修改VSObjectFactory.pm 中的 DetermineVisualStudioVersion 直接return '9.00';


2.。在 ALTER TABLE accounts ENABLE ROW LEVEL SECURITY;时

a ) 在函数 ATExecEnableRowSecurity 把pg_class中的 relrowsecurity 置为 true


3。CREATE POLICY account_managers ON accounts TO managers USING (manager = current_user);

对系统表pg_policy增加了一条记录

#define PolicyRelationId3256

CATALOG(pg_policy,3256)
{
NameDatapolname;/* Policy name. */
Oidpolrelid;/* Oid of the relation with policy. */
charpolcmd;/* One of ACL_*_CHR,or '*' for all */

#ifdef CATALOG_VARLEN
Oidpolroles[1];/* Roles associated with policy,not-NULL */
pg_node_tree polqual;/* Policy quals. */
pg_node_tree polwithcheck;/* WITH CHECK quals. */
#endif
} FormData_pg_policy;


4。使用时,就是在select或是insert时,把rewirte阶段,把polqual 和 polwithcheck 加到后面,之后在执行时进行判断

rewrite调用的函数 get_row_security_policies

执行时调用函数 ExecWithCheckOptions、ExecWithCheckOptions



和MAC的区别

1。没有等级和范围的概念

2。管理员还是可以看到全部数据

3。MAC特权概念不明显

4。Row Security Policies 需要在用户表的设计时加上限制的字段,需要改应用


??
??
??
??

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读