PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/table.h"
#include "catalog/pg_class.h"
#include "catalog/pg_type.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/pg_list.h"
#include "parser/parse_relation.h"
#include "rewrite/rewriteDefine.h"
#include "rewrite/rewriteManip.h"
#include "rewrite/rowsecurity.h"
#include "utils/acl.h"
#include "utils/rel.h"
#include "utils/rls.h"
Go to the source code of this file.
Macros | |
#define | QUAL_FOR_WCO(policy) |
Functions | |
static void | get_policies_for_relation (Relation relation, CmdType cmd, Oid user_id, List **permissive_policies, List **restrictive_policies) |
static void | sort_policies_by_name (List *policies) |
static int | row_security_policy_cmp (const ListCell *a, const ListCell *b) |
static void | add_security_quals (int rt_index, List *permissive_policies, List *restrictive_policies, List **securityQuals, bool *hasSubLinks) |
static void | add_with_check_options (Relation rel, int rt_index, WCOKind kind, List *permissive_policies, List *restrictive_policies, List **withCheckOptions, bool *hasSubLinks, bool force_using) |
static bool | check_role_for_policy (ArrayType *policy_roles, Oid user_id) |
void | get_row_security_policies (Query *root, RangeTblEntry *rte, int rt_index, List **securityQuals, List **withCheckOptions, bool *hasRowSecurity, bool *hasSubLinks) |
Variables | |
row_security_policy_hook_type | row_security_policy_hook_permissive = NULL |
row_security_policy_hook_type | row_security_policy_hook_restrictive = NULL |
#define QUAL_FOR_WCO | ( | policy | ) |
|
static |
Definition at line 700 of file rowsecurity.c.
References BoolGetDatum(), ChangeVarNodes(), copyObject, RowSecurityPolicy::hassublinks, InvalidOid, lappend(), lfirst, linitial, list_append_unique(), list_length(), makeBoolExpr(), makeConst(), NIL, OR_EXPR, and RowSecurityPolicy::qual.
Referenced by get_row_security_policies().
|
static |
Definition at line 796 of file rowsecurity.c.
References BoolGetDatum(), WithCheckOption::cascaded, ChangeVarNodes(), copyObject, RowSecurityPolicy::hassublinks, InvalidOid, WithCheckOption::kind, lappend(), lfirst, linitial, list_append_unique(), list_length(), makeBoolExpr(), makeConst(), makeNode, NIL, OR_EXPR, RowSecurityPolicy::policy_name, WithCheckOption::polname, pstrdup(), WithCheckOption::qual, QUAL_FOR_WCO, RelationGetRelationName, and WithCheckOption::relname.
Referenced by get_row_security_policies().
Definition at line 916 of file rowsecurity.c.
References ACL_ID_PUBLIC, ARR_DATA_PTR, ARR_DIMS, has_privs_of_role(), and i.
Referenced by get_policies_for_relation().
|
static |
Definition at line 541 of file rowsecurity.c.
References ACL_DELETE_CHR, ACL_INSERT_CHR, ACL_SELECT_CHR, ACL_UPDATE_CHR, check_role_for_policy(), CMD_DELETE, CMD_INSERT, CMD_MERGE, CMD_SELECT, CMD_UPDATE, elog, ERROR, lappend(), lfirst, NIL, RowSecurityPolicy::permissive, RowSecurityPolicy::polcmd, RowSecurityDesc::policies, RelationData::rd_rsdesc, RowSecurityPolicy::roles, row_security_policy_hook_permissive, row_security_policy_hook_restrictive, and sort_policies_by_name().
Referenced by get_row_security_policies().
void get_row_security_policies | ( | Query * | root, |
RangeTblEntry * | rte, | ||
int | rt_index, | ||
List ** | securityQuals, | ||
List ** | withCheckOptions, | ||
bool * | hasRowSecurity, | ||
bool * | hasSubLinks | ||
) |
Definition at line 98 of file rowsecurity.c.
References ACL_SELECT, ACL_UPDATE, add_security_quals(), add_with_check_options(), Assert, check_enable_rls(), RTEPermissionInfo::checkAsUser, CMD_DELETE, CMD_INSERT, CMD_MERGE, CMD_SELECT, CMD_UPDATE, get_policies_for_relation(), getRTEPermissionInfo(), GetUserId(), NIL, NoLock, OidIsValid, ONCONFLICT_UPDATE, RangeTblEntry::relid, RTEPermissionInfo::requiredPerms, RLS_NONE, RLS_NONE_ENV, root, RTE_RELATION, RangeTblEntry::rtekind, setRuleCheckAsUser(), table_close(), table_open(), WCO_RLS_CONFLICT_CHECK, WCO_RLS_INSERT_CHECK, WCO_RLS_MERGE_DELETE_CHECK, WCO_RLS_MERGE_UPDATE_CHECK, and WCO_RLS_UPDATE_CHECK.
Referenced by fireRIRrules().
Definition at line 674 of file rowsecurity.c.
References a, b, lfirst, and RowSecurityPolicy::policy_name.
Referenced by sort_policies_by_name().
|
static |
Definition at line 665 of file rowsecurity.c.
References list_sort(), and row_security_policy_cmp().
Referenced by get_policies_for_relation().
row_security_policy_hook_type row_security_policy_hook_permissive = NULL |
Definition at line 86 of file rowsecurity.c.
Referenced by _PG_init(), and get_policies_for_relation().
row_security_policy_hook_type row_security_policy_hook_restrictive = NULL |
Definition at line 87 of file rowsecurity.c.
Referenced by _PG_init(), and get_policies_for_relation().