问题描述
在PostgreSQL中是否可以仅向一个模式赋予特定用户或组的编辑权限?我需要用户仅更改架构中的对象.与超级用户权限类似,但仅适用于一种模式.
Is it possible in PostgreSQL to give a specific user or group on edit rights only to one schema?I need the user to only change the objects in the schema. Similar to superuser rights, but only for one schema.
感谢前进
推荐答案
在您的情况下,最佳设置可能如下.
The best setup in your case is probably the following.
让我们假设架构和其中的对象由object_owner
拥有,并且该用户应具有超级用户"特权称为wannabe
.
Let's assume that the schema and the objects therein are owned by object_owner
and the user that should have “superuser” privileges is called wannabe
.
然后您可以执行以下操作:
Then you can do:
ALTER ROLE wannabe NOINHERIT;
GRANT object_owner TO wannabe;
这允许wannabe
通过运行变为object_owner
SET ROLE object_owner;
与在UNIX中使用su
相似.使用RESET ROLE
再次下移.
similar to using su
in UNIX. Use RESET ROLE
to step down again.
这篇关于在PostgreSQL中是否可以仅对一个模式授予特定用户或组的编辑权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!