mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Get rid of the separate RULE privilege for tables: now only a table's owner
can create or modify rules for the table. Do setRuleCheckAsUser() while loading rules into the relcache, rather than when defining a rule. This ensures that permission checks for tables referenced in a rule are done with respect to the current owner of the rule's table, whereas formerly ALTER TABLE OWNER would fail to update the permission checking for associated rules. Removal of separate RULE privilege is needed to prevent various scenarios in which a grantee of RULE privilege could effectively have any privilege of the table owner. For backwards compatibility, GRANT/REVOKE RULE is still accepted, but it doesn't do anything. Per discussion here: http://archives.postgresql.org/pgsql-hackers/2006-04/msg01138.php
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ddl.sgml,v 1.60 2006/07/14 00:13:05 neilc Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ddl.sgml,v 1.61 2006/09/05 21:08:33 tgl Exp $ -->
|
||||
|
||||
<chapter id="ddl">
|
||||
<title>Data Definition</title>
|
||||
@ -1342,7 +1342,7 @@ ALTER TABLE products RENAME TO items;
|
||||
<para>
|
||||
There are several different privileges: <literal>SELECT</>,
|
||||
<literal>INSERT</>, <literal>UPDATE</>, <literal>DELETE</>,
|
||||
<literal>RULE</>, <literal>REFERENCES</>, <literal>TRIGGER</>,
|
||||
<literal>REFERENCES</>, <literal>TRIGGER</>,
|
||||
<literal>CREATE</>, <literal>CONNECT</>, <literal>TEMPORARY</>,
|
||||
<literal>EXECUTE</>, and <literal>USAGE</>.
|
||||
The privileges applicable to a particular
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.333 2006/09/04 21:47:25 momjian Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.334 2006/09/05 21:08:33 tgl Exp $ -->
|
||||
|
||||
<chapter id="functions">
|
||||
<title>Functions and Operators</title>
|
||||
@ -9543,9 +9543,10 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
|
||||
the name can be schema-qualified if necessary.
|
||||
The desired access privilege type
|
||||
is specified by a text string, which must evaluate to one of the
|
||||
values <literal>SELECT</literal>, <literal>INSERT</literal>, <literal>UPDATE</literal>,
|
||||
<literal>DELETE</literal>, <literal>RULE</literal>, <literal>REFERENCES</literal>, or
|
||||
<literal>TRIGGER</literal>. (Case of the string is not significant, however.)
|
||||
values <literal>SELECT</literal>, <literal>INSERT</literal>,
|
||||
<literal>UPDATE</literal>, <literal>DELETE</literal>,
|
||||
<literal>REFERENCES</literal>, or <literal>TRIGGER</literal>.
|
||||
(Case of the string is not significant, however.)
|
||||
An example is:
|
||||
<programlisting>
|
||||
SELECT has_table_privilege('myschema.mytable', 'select');
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.26 2006/05/02 18:07:51 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.27 2006/09/05 21:08:34 tgl Exp $ -->
|
||||
|
||||
<chapter id="information-schema">
|
||||
<title>The Information Schema</title>
|
||||
@ -2832,7 +2832,7 @@ ORDER BY c.ordinal_position;
|
||||
Type of the privilege: <literal>SELECT</literal>,
|
||||
<literal>DELETE</literal>, <literal>INSERT</literal>,
|
||||
<literal>UPDATE</literal>, <literal>REFERENCES</literal>,
|
||||
<literal>RULE</literal>, or <literal>TRIGGER</literal>
|
||||
or <literal>TRIGGER</literal>
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
@ -4418,7 +4418,7 @@ ORDER BY c.ordinal_position;
|
||||
Type of the privilege: <literal>SELECT</literal>,
|
||||
<literal>DELETE</literal>, <literal>INSERT</literal>,
|
||||
<literal>UPDATE</literal>, <literal>REFERENCES</literal>,
|
||||
<literal>RULE</literal>, or <literal>TRIGGER</literal>
|
||||
or <literal>TRIGGER</literal>
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.46 2006/09/02 17:06:52 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.47 2006/09/05 21:08:35 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -200,8 +200,7 @@ CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS
|
||||
<title>Notes</title>
|
||||
|
||||
<para>
|
||||
You must have the privilege <literal>RULE</literal> on a table to
|
||||
be allowed to define a rule on it.
|
||||
You must be the owner of a table to create or change rules for it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.60 2006/08/02 16:29:49 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.61 2006/09/05 21:08:35 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -20,7 +20,7 @@ PostgreSQL documentation
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
GRANT { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER }
|
||||
GRANT { { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER }
|
||||
[,...] | ALL [ PRIVILEGES ] }
|
||||
ON [ TABLE ] <replaceable class="PARAMETER">tablename</replaceable> [, ...]
|
||||
TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
|
||||
@ -178,16 +178,6 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>RULE</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Allows the creation of a rule on the table/view. (See the <xref
|
||||
linkend="sql-createrule" endterm="sql-createrule-title"> statement.)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>REFERENCES</term>
|
||||
<listitem>
|
||||
@ -418,8 +408,8 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
|
||||
|
||||
Access privileges for database "lusitania"
|
||||
Schema | Name | Type | Access privileges
|
||||
--------+---------+-------+------------------------------------------------------------
|
||||
public | mytable | table | {miriam=arwdRxt/miriam,=r/miriam,"group todos=arw/miriam"}
|
||||
--------+---------+-------+-----------------------------------------------------------
|
||||
public | mytable | table | {miriam=arwdxt/miriam,=r/miriam,"group todos=arw/miriam"}
|
||||
(1 row)
|
||||
</programlisting>
|
||||
The entries shown by <command>\z</command> are interpreted thus:
|
||||
@ -432,7 +422,6 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
|
||||
w -- UPDATE ("write")
|
||||
a -- INSERT ("append")
|
||||
d -- DELETE
|
||||
R -- RULE
|
||||
x -- REFERENCES
|
||||
t -- TRIGGER
|
||||
X -- EXECUTE
|
||||
@ -440,7 +429,7 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
|
||||
C -- CREATE
|
||||
c -- CONNECT
|
||||
T -- TEMPORARY
|
||||
arwdRxt -- ALL PRIVILEGES (for tables)
|
||||
arwdxt -- ALL PRIVILEGES (for tables)
|
||||
* -- grant option for preceding privilege
|
||||
|
||||
/yyyy -- user who granted this privilege
|
||||
@ -463,7 +452,7 @@ and may include some privileges for <literal>PUBLIC</> depending on the
|
||||
object type, as explained above. The first <command>GRANT</> or
|
||||
<command>REVOKE</> on an object
|
||||
will instantiate the default privileges (producing, for example,
|
||||
<literal>{miriam=arwdRxt/miriam}</>) and then modify them per the
|
||||
<literal>{miriam=arwdxt/miriam}</>) and then modify them per the
|
||||
specified request.
|
||||
</para>
|
||||
|
||||
@ -548,8 +537,7 @@ GRANT <replaceable class="PARAMETER">privileges</replaceable>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <literal>RULE</literal> privilege, and privileges on
|
||||
databases, tablespaces, schemas, and languages are
|
||||
Privileges on databases, tablespaces, schemas, and languages are
|
||||
<productname>PostgreSQL</productname> extensions.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.39 2006/08/02 16:29:49 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.40 2006/09/05 21:08:35 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -21,7 +21,7 @@ PostgreSQL documentation
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
REVOKE [ GRANT OPTION FOR ]
|
||||
{ { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER }
|
||||
{ { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER }
|
||||
[,...] | ALL [ PRIVILEGES ] }
|
||||
ON [ TABLE ] <replaceable class="PARAMETER">tablename</replaceable> [, ...]
|
||||
FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...]
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/user-manag.sgml,v 1.36 2006/08/02 16:29:49 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/user-manag.sgml,v 1.37 2006/09/05 21:08:34 tgl Exp $ -->
|
||||
|
||||
<chapter id="user-manag">
|
||||
<title>Database Roles and Privileges</title>
|
||||
@ -293,7 +293,7 @@ ALTER ROLE myname SET enable_indexscan TO off;
|
||||
granted.
|
||||
There are several different kinds of privilege: <literal>SELECT</>,
|
||||
<literal>INSERT</>, <literal>UPDATE</>, <literal>DELETE</>,
|
||||
<literal>RULE</>, <literal>REFERENCES</>, <literal>TRIGGER</>,
|
||||
<literal>REFERENCES</>, <literal>TRIGGER</>,
|
||||
<literal>CREATE</>, <literal>CONNECT</>, <literal>TEMPORARY</>,
|
||||
<literal>EXECUTE</>, and <literal>USAGE</>.
|
||||
For more information on the different types of privileges supported by
|
||||
|
Reference in New Issue
Block a user