diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-11-13 08:11:17 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-11-13 08:12:37 +0100 |
commit | afbfc02983f86c4d71825efa6befd547fe81a926 (patch) | |
tree | 0cff343b85d5c01fb022e0433d89f5d350609fd4 /src/include/utils | |
parent | b4b7ce8061d34cea2b4915c41403b2a74d5fde0e (diff) | |
download | postgresql-afbfc02983f86c4d71825efa6befd547fe81a926.tar.gz |
Refactor ownercheck functions
Instead of dozens of mostly-duplicate pg_foo_ownercheck() functions,
write one common function object_ownercheck() that can handle almost
all of them. We already have all the information we need, such as
which system catalog corresponds to which catalog table and which
column is the owner column.
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Discussion: https://www.postgresql.org/message-id/flat/95c30f96-4060-2f48-98b5-a4392d3b6066@enterprisedb.com
Diffstat (limited to 'src/include/utils')
-rw-r--r-- | src/include/utils/acl.h | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index 9a4df3a5da..79eff59768 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -306,28 +306,7 @@ extern void removeExtObjInitPriv(Oid objoid, Oid classoid); /* ownercheck routines just return true (owner) or false (not) */ -extern bool pg_class_ownercheck(Oid class_oid, Oid roleid); -extern bool pg_type_ownercheck(Oid type_oid, Oid roleid); -extern bool pg_oper_ownercheck(Oid oper_oid, Oid roleid); -extern bool pg_proc_ownercheck(Oid proc_oid, Oid roleid); -extern bool pg_language_ownercheck(Oid lan_oid, Oid roleid); -extern bool pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid); -extern bool pg_namespace_ownercheck(Oid nsp_oid, Oid roleid); -extern bool pg_tablespace_ownercheck(Oid spc_oid, Oid roleid); -extern bool pg_opclass_ownercheck(Oid opc_oid, Oid roleid); -extern bool pg_opfamily_ownercheck(Oid opf_oid, Oid roleid); -extern bool pg_database_ownercheck(Oid db_oid, Oid roleid); -extern bool pg_collation_ownercheck(Oid coll_oid, Oid roleid); -extern bool pg_conversion_ownercheck(Oid conv_oid, Oid roleid); -extern bool pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid); -extern bool pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid); -extern bool pg_foreign_data_wrapper_ownercheck(Oid srv_oid, Oid roleid); -extern bool pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid); -extern bool pg_event_trigger_ownercheck(Oid et_oid, Oid roleid); -extern bool pg_extension_ownercheck(Oid ext_oid, Oid roleid); -extern bool pg_publication_ownercheck(Oid pub_oid, Oid roleid); -extern bool pg_subscription_ownercheck(Oid sub_oid, Oid roleid); -extern bool pg_statistics_object_ownercheck(Oid stat_oid, Oid roleid); +extern bool object_ownercheck(Oid classid, Oid objectid, Oid roleid); extern bool has_createrole_privilege(Oid roleid); extern bool has_bypassrls_privilege(Oid roleid); |