rowsecurity.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* -------------------------------------------------------------------------
  2. *
  3. * rowsecurity.h
  4. *
  5. * prototypes for rewrite/rowsecurity.c and the structures for managing
  6. * the row security policies for relations in relcache.
  7. *
  8. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  9. * Portions Copyright (c) 1994, Regents of the University of California
  10. *
  11. * -------------------------------------------------------------------------
  12. */
  13. #ifndef ROWSECURITY_H
  14. #define ROWSECURITY_H
  15. #include "nodes/parsenodes.h"
  16. #include "utils/array.h"
  17. #include "utils/relcache.h"
  18. typedef struct RowSecurityPolicy
  19. {
  20. char *policy_name; /* Name of the policy */
  21. char polcmd; /* Type of command policy is for */
  22. ArrayType *roles; /* Array of roles policy is for */
  23. Expr *qual; /* Expression to filter rows */
  24. Expr *with_check_qual; /* Expression to limit rows allowed */
  25. bool hassublinks; /* If either expression has sublinks */
  26. } RowSecurityPolicy;
  27. typedef struct RowSecurityDesc
  28. {
  29. MemoryContext rscxt; /* row security memory context */
  30. List *policies; /* list of row security policies */
  31. } RowSecurityDesc;
  32. typedef List *(*row_security_policy_hook_type) (CmdType cmdtype,
  33. Relation relation);
  34. extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive;
  35. extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_restrictive;
  36. extern void get_row_security_policies(Query *root,
  37. RangeTblEntry *rte, int rt_index,
  38. List **securityQuals, List **withCheckOptions,
  39. bool *hasRowSecurity, bool *hasSubLinks);
  40. #endif /* ROWSECURITY_H */