Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f9fd176

Browse files
committed
Add pg_has_role() family of privilege inquiry functions modeled after the
existing ones for object privileges. Update the information_schema for roles --- pg_has_role() makes this a whole lot easier, removing the need for most of the explicit joins with pg_user. The views should be a tad faster now, too. Stephen Frost and Tom Lane.
1 parent e5d6b91 commit f9fd176

File tree

6 files changed

+383
-132
lines changed

6 files changed

+383
-132
lines changed

doc/src/sgml/func.sgml

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.270 2005/07/25 22:12:30 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.271 2005/07/26 00:04:17 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -8427,6 +8427,21 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
84278427
<entry><type>boolean</type></entry>
84288428
<entry>does current user have privilege for language</entry>
84298429
</row>
8430+
<row>
8431+
<entry><literal><function>pg_has_role</function>(<parameter>user</parameter>,
8432+
<parameter>role</parameter>,
8433+
<parameter>privilege</parameter>)</literal>
8434+
</entry>
8435+
<entry><type>boolean</type></entry>
8436+
<entry>does user have privilege for role</entry>
8437+
</row>
8438+
<row>
8439+
<entry><literal><function>pg_has_role</function>(<parameter>role</parameter>,
8440+
<parameter>privilege</parameter>)</literal>
8441+
</entry>
8442+
<entry><type>boolean</type></entry>
8443+
<entry>does current user have privilege for role</entry>
8444+
</row>
84308445
<row>
84318446
<entry><literal><function>has_schema_privilege</function>(<parameter>user</parameter>,
84328447
<parameter>schema</parameter>,
@@ -8473,6 +8488,9 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
84738488
<indexterm zone="functions-info">
84748489
<primary>has_language_privilege</primary>
84758490
</indexterm>
8491+
<indexterm zone="functions-info">
8492+
<primary>pg_has_role</primary>
8493+
</indexterm>
84768494
<indexterm zone="functions-info">
84778495
<primary>has_schema_privilege</primary>
84788496
</indexterm>
@@ -8536,6 +8554,14 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
85368554
<literal>USAGE</literal>.
85378555
</para>
85388556

8557+
<para>
8558+
<function>pg_has_role</function> checks whether a user
8559+
can access a role in a particular way. The possibilities for its
8560+
arguments are analogous to <function>has_table_privilege</function>.
8561+
The desired access privilege type must evaluate to
8562+
<literal>MEMBER</literal>.
8563+
</para>
8564+
85398565
<para>
85408566
<function>has_schema_privilege</function> checks whether a user
85418567
can access a schema in a particular way. The possibilities for its

0 commit comments

Comments
 (0)