在PostgreSQL中是否可以仅对一个模式授予特定用户或组的编辑权限? [英] Is it possible in PostgreSQL to give a specific user or group on edit rights only to one schema?

查看:393
本文介绍了在PostgreSQL中是否可以仅对一个模式授予特定用户或组的编辑权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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中是否可以仅对一个模式授予特定用户或组的编辑权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆