mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
pgindent run for 9.5
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* rls.c
|
||||
* RLS-related utility functions.
|
||||
* RLS-related utility functions.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/backend/utils/misc/rls.c
|
||||
* src/backend/utils/misc/rls.c
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "utils/syscache.h"
|
||||
|
||||
|
||||
extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError);
|
||||
extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError);
|
||||
|
||||
/*
|
||||
* check_enable_rls
|
||||
@@ -48,10 +48,10 @@ extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError);
|
||||
int
|
||||
check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
|
||||
{
|
||||
HeapTuple tuple;
|
||||
Form_pg_class classform;
|
||||
bool relrowsecurity;
|
||||
Oid user_id = checkAsUser ? checkAsUser : GetUserId();
|
||||
HeapTuple tuple;
|
||||
Form_pg_class classform;
|
||||
bool relrowsecurity;
|
||||
Oid user_id = checkAsUser ? checkAsUser : GetUserId();
|
||||
|
||||
tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
@@ -88,25 +88,24 @@ check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
|
||||
|
||||
/*
|
||||
* If the row_security GUC is 'off' then check if the user has permission
|
||||
* to bypass it. Note that we have already handled the case where the user
|
||||
* is the table owner above.
|
||||
* to bypass it. Note that we have already handled the case where the
|
||||
* user is the table owner above.
|
||||
*
|
||||
* Note that row_security is always considered 'on' when querying
|
||||
* through a view or other cases where checkAsUser is true, so skip this
|
||||
* if checkAsUser is in use.
|
||||
* Note that row_security is always considered 'on' when querying through
|
||||
* a view or other cases where checkAsUser is true, so skip this if
|
||||
* checkAsUser is in use.
|
||||
*/
|
||||
if (!checkAsUser && row_security == ROW_SECURITY_OFF)
|
||||
{
|
||||
if (has_bypassrls_privilege(user_id))
|
||||
/* OK to bypass */
|
||||
return RLS_NONE_ENV;
|
||||
else if (noError)
|
||||
return RLS_ENABLED;
|
||||
else
|
||||
if (noError)
|
||||
return RLS_ENABLED;
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("insufficient privilege to bypass row security.")));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("insufficient privilege to bypass row security.")));
|
||||
}
|
||||
|
||||
/* RLS should be fully enabled for this relation. */
|
||||
|
||||
Reference in New Issue
Block a user