diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 2cbb2ba5b2e..141310b14ca 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -134,6 +134,7 @@ bbf_get_sysadmin_oid_hook_type bbf_get_sysadmin_oid_hook = NULL; get_bbf_admin_oid_hook_type get_bbf_admin_oid_hook = NULL; pltsql_get_object_owner_hook_type pltsql_get_object_owner_hook = NULL; is_bbf_db_ddladmin_operation_hook_type is_bbf_db_ddladmin_operation_hook = NULL; +bbf_check_member_has_direct_priv_to_grant_role_hook_type bbf_check_member_has_direct_priv_to_grant_role_hook = NULL; /* @@ -5278,6 +5279,12 @@ is_admin_of_role(Oid member, Oid role) if (member == role) return false; + if ((bbf_check_member_has_direct_priv_to_grant_role_hook) + && (*bbf_check_member_has_direct_priv_to_grant_role_hook)(member, role)) + { + return true; + } + (void) roles_is_member_of(member, ROLERECURSE_MEMBERS, role, &admin_role); return OidIsValid(admin_role); } diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index 1df439f3692..b672a2f340d 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -309,6 +309,9 @@ extern PGDLLEXPORT is_bbf_db_ddladmin_operation_hook_type is_bbf_db_ddladmin_ope typedef bool (*pltsql_allow_storing_init_privs_hook_type) (Oid objoid, Oid classoid, int objsubid); extern PGDLLEXPORT pltsql_allow_storing_init_privs_hook_type pltsql_allow_storing_init_privs_hook; +typedef bool (*bbf_check_member_has_direct_priv_to_grant_role_hook_type) (Oid, Oid); +extern PGDLLEXPORT bbf_check_member_has_direct_priv_to_grant_role_hook_type bbf_check_member_has_direct_priv_to_grant_role_hook; + #define IS_BBF_DB_DDLADMIN(namespaceId) \ (is_bbf_db_ddladmin_operation_hook && \ is_bbf_db_ddladmin_operation_hook(namespaceId))