当前位置:网站首页>greenplum role /user 管理
greenplum role /user 管理
2022-08-03 07:49:00 【weixin_40455124】
greenplum role 其实是一个可inherit的user,要可以在客户端使用需要
1、在gp里面创建并赋予login等权限
2、在master的pg_hba.conf里面赋予允许登录ip
查看全部role可以通过以下sql之一
SELECT * FROM pg_catalog.pg_roles;
SELECT * FROM pg_catalog.pg_user;
pg_hba.conf的用途:PostgreSQL Client Authentication Configuration File,可以参考:
https://blog.csdn.net/yaoqiancuo3276/article/details/80404883?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165939278816780357238380%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=165939278816780357238380&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2blogtop_positive~default-1-80404883-null-null.nonecase&utm_term=pg_hba.conf&spm=1018.2226.3001.4450
依据 vmware的文档role的主要内容包括
- Role Attributes :允许登录、inherit、链接限制、归属资源队列、超级用户、密码(可以用ENCRYPTED PASSWORD加强密码管理)、创建db、创建角色等等
- Membership: grant/revoke 其它角色
- 对象权限
- 不允许登录时间
不允许登录时间
可以按每星期的哪天(0-6 ,sunday-Saturday)不允许登录进行限制
test=# create role denytest deny day 'Saturday';
NOTICE: resource queue required -- using default resource queue "pg_default"
CREATE ROLE
test=# alter role denytest deny between day 'Monday' Time '15:00' AND day 'Sunday' TIME '10:00';
ERROR: time interval must not wrap around
test=# alter role denytest deny between day 'Monday' Time '15:00' AND day 'Friday' TIME '10:00';
ALTER ROLE
test=# alter role denytest drop deny for day 'Saturday';
NOTICE: dropping DENY rule for "denytest" between Saturday 00:00:00 and Saturday 24:00:00
ALTER ROLE
test=# alter role denytest drop deny for day 'Monday'
test-# ;
NOTICE: dropping DENY rule for "denytest" between Monday 15:00:00 and Friday 10:00:00
ALTER ROLE
查看role inherit
查看全部role inherit 关系
select a.oid as user_role_id
, a.rolname as user_role_name
, b.roleid as other_role_id
, c.rolname as other_role_name
from pg_roles a
inner join pg_auth_members b on a.oid=b.member
inner join pg_roles c on b.roleid=c.oid
--where a.rolname = 'user_1'
也可以使用
SELECT oid, rolname FROM pg_roles WHERE
pg_has_role( 'mch', oid, 'member');
查看单个。
测试sql如下:
test=# SELECT oid, rolname FROM pg_roles WHERE
pg_has_role( 'mch', oid, 'member');
oid | rolname
-------+---------
19164 | mch
19166 | admin
(2 rows)
test=# revoke admin from mch;
REVOKE ROLE
test=# SELECT oid, rolname FROM pg_roles WHERE
pg_has_role( 'mch', oid, 'member');
oid | rolname
-------+---------
19164 | mch
(1 row)
边栏推荐
猜你喜欢
随机推荐
2022下半年软考「高项&集成」复习计划ta来喽~
word之个人设置
sqlserver2019安装失败
进程的创建
AI中台序列标注任务:三个数据集构造过程记录
frp: open source intranet penetration tool
ViewModel 记录下 +
day12---接口和协议
Mysql的in和exists用法区别
如何在安装GBase 8c数据库的时候,报错显示“Host ips belong to different cluster?
ArcEngine (3) zoom in and zoom out through the MapControl control to achieve full-image roaming
AI mid-stage sequence labeling task: three data set construction process records
STL-vector容器
[ 漏洞复现篇 ] yapi 代码执行 getshell 漏洞复现详解
mysql服务器上的mysql这个实例中表的介绍
循环神经网络RNN基础《PyTorch深度学习实践》
Taro框架-微信小程序-内嵌h5页面
MySQL or使索引失效
002-字段不为null
“==”和equals的区别