Re: "grant usage on schema" confers the ability to execute all user-defined functions in that schema, with needing to grant "execute"

Поиск
Список
Период
Сортировка
От Bryn Llewellyn
Тема Re: "grant usage on schema" confers the ability to execute all user-defined functions in that schema, with needing to grant "execute"
Дата
Msg-id 79C1E496-895A-4B1C-ABF5-3BF0755DADEE@yugabyte.com
обсуждение исходный текст
Ответ на Re: "grant usage on schema" confers the ability to execute all user-defined functions in that schema, with needing to grant "execute"  (Julien Rouhaud <rjuju123@gmail.com>)
Ответы Re: "grant usage on schema" confers the ability to execute all user-defined functions in that schema, with needing to grant "execute"  (Dominique Devienne <ddevienne@gmail.com>)
Список pgsql-general
rjuju123@gmail.com wrote:

adrian.klaver@aklaver.com wrote:


I s'pose that I can interpret this output in the light of the "miriam" example by guessing than an empty LHS means "public" and that the initial "X" means "execute". It looks like what follows the slash is the owner of the object (a denormalization of what the "Owner" column shows.) Where is this notation, "miriam=arwdDxt/miriam", explained?

Here:
Table 5.1. ACL Privilege Abbreviations

You might also be interested in aclexplode() function, see:
9.26. System Information Functions and Operators

Thanks, Adrian. I'm embarrassed that I didn't notice Table 5.1.

Thanks, Julien. I tried a little test. I created a function "s.q()" with owner "x" and then granted "execute" on it to user "z". But I didn't yet revoke "execute" on "s.q()" from "public".

This is whet the "Access privilege" column in the \df+ report for "s.q()" shows:

  =X/x
  x=X/x
  z=X/x

I.e. three facts per row: grantee, privilege, and grantee. Then I did this:

with c as (
  select
    proname::text                     as name,
    pronamespace::regnamespace::text  as schema,
    aclexplode(proacl)                as "aclexplode(proacl)"
  from pg_catalog.pg_proc)
select 
"aclexplode(proacl)" from c
where name = 'q' and schema = 's';

This is the result:

     aclexplode(proacl)      
-----------------------------
 (1494148,0,EXECUTE,f)
 (1494148,1494148,EXECUTE,f)
 (1494148,1494150,EXECUTE,f)

This is consistent with the doc that says the array is exploded to records with this signature:

(grantor oid, grantee oid, privilege_type text, is_grantable boolean )

This is the perfect starting point for the table function that I was after that would list all user-defined functions and procedures that have "execute" granted to "public". A little bit of perfectly manageable effort will be needed for the special case that when "proacl" is "null", it means that "public" has "execute"—and also to translate the "oid" values" to text.

I'll try this presently and report back.

В списке pgsql-general по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: "grant usage on schema" confers the ability to execute all user-defined functions in that schema, with needing to grant "execute"
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Can we go beyond the standard to make Postgres radically better?