zoukankan      html  css  js  c++  java
  • postgresql

    权限查询

    https://blog.csdn.net/opendba/article/details/5860002

    • z test
    postgres=# z test
                                           Access privileges
     Schema | Name | Type  | Access privileges | Column privileges |           Policies            
    --------+------+-------+-------------------+-------------------+-------------------------------
     public | test | table | sa=arwdDxt/sa    +|                   | p4 (w):                      +
            |      |       | =arwdDxt/sa       |                   |   (u): (r = "current_user"())+
            |      |       |                   |                   |   to: r3                     +
            |      |       |                   |                   | p1 (r):                      +
            |      |       |                   |                   |   (u): (r = "current_user"())+
            |      |       |                   |                   |   to: r3
    (1 row)
    
    • dp test
    postgres=# dp test
                                           Access privileges
     Schema | Name | Type  | Access privileges | Column privileges |           Policies            
    --------+------+-------+-------------------+-------------------+-------------------------------
     public | test | table | sa=arwdDxt/sa    +|                   | p4 (w):                      +
            |      |       | =arwdDxt/sa       |                   |   (u): (r = "current_user"())+
            |      |       |                   |                   |   to: r3                     +
            |      |       |                   |                   | p1 (r):                      +
            |      |       |                   |                   |   (u): (r = "current_user"())+
            |      |       |                   |                   |   to: r3
    (1 row)
    
    
    
    • 查看用户有哪些权限:INFORMATION_SCHEMA.role_table_grants或者table_privileges
    postgres=# select * from INFORMATION_SCHEMA.role_table_grants where grantee = 'lisi';
     grantor | grantee | table_catalog | table_schema |     table_name     | privilege_type | is_grantable | with_hierarchy 
    ---------+---------+---------------+--------------+--------------------+----------------+--------------+----------------
     sa      | lisi    | postgres      | public       | t_ssl              | SELECT         | NO           | YES
    、、、
    (20 rows)
    
    postgres=# select * from information_schema.table_privileges where grantee='lisi';
     grantor | grantee | table_catalog | table_schema |     table_name     | privilege_type | is_grantable | with_hierarchy 
    ---------+---------+---------------+--------------+--------------------+----------------+--------------+----------------
     sa      | lisi    | postgres      | public       | t_ssl              | SELECT         | NO           | YES
    、、、
    (20 rows)
    
    • 查看usage权限表

    select * from information_schema.usage_privileges where grantee='user_name';

    • 查看存储过程函数相关权限表

    select * from information_schema.routine_privileges where grantee='user_name';

  • 相关阅读:
    poj2328简单模拟
    一个简单的Silverlight的DataBinding和DateTemplate的Demo
    poj3468线段树_区间数字统计
    一个Silverlight的可视化图的DataBinding的Demo
    poj3321 dfs+树状数组
    C#拖拽控件
    【存档归纳】Sqlserver数据库详解 深度挖掘sqlserver帮助所得 一
    电脑蓝屏原因分析利器
    C# B/S程序如何获取客户端的MAC地址
    尚需研究之QQ音乐首页的图片轮换
  • 原文地址:https://www.cnblogs.com/zhangfx01/p/14367582.html
Copyright © 2011-2022 走看看