PostgreSQL Source Code  git master
acl.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * acl.h
4  * Definition of (and support for) access control list data structures.
5  *
6  *
7  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/utils/acl.h
11  *
12  * NOTES
13  * An ACL array is simply an array of AclItems, representing the union
14  * of the privileges represented by the individual items. A zero-length
15  * array represents "no privileges".
16  *
17  * The order of items in the array is important as client utilities (in
18  * particular, pg_dump, though possibly other clients) expect to be able
19  * to issue GRANTs in the ordering of the items in the array. The reason
20  * this matters is that GRANTs WITH GRANT OPTION must be before any GRANTs
21  * which depend on it. This happens naturally in the backend during
22  * operations as we update ACLs in-place, new items are appended, and
23  * existing entries are only removed if there's no dependency on them (no
24  * GRANT can been based on it, or, if there was, those GRANTs are also
25  * removed).
26  *
27  * For backward-compatibility purposes we have to allow null ACL entries
28  * in system catalogs. A null ACL will be treated as meaning "default
29  * protection" (i.e., whatever acldefault() returns).
30  *-------------------------------------------------------------------------
31  */
32 #ifndef ACL_H
33 #define ACL_H
34 
35 #include "access/htup.h"
36 #include "nodes/parsenodes.h"
37 #include "parser/parse_node.h"
38 #include "utils/snapshot.h"
39 
40 
41 /*
42  * typedef AclMode is declared in parsenodes.h, also the individual privilege
43  * bit meanings are defined there
44  */
45 
46 #define ACL_ID_PUBLIC 0 /* placeholder for id in a PUBLIC acl item */
47 
48 /*
49  * AclItem
50  *
51  * Note: must be same size on all platforms, because the size is hardcoded
52  * in the pg_type.h entry for aclitem.
53  */
54 typedef struct AclItem
55 {
56  Oid ai_grantee; /* ID that this item grants privs to */
57  Oid ai_grantor; /* grantor of privs */
58  AclMode ai_privs; /* privilege bits */
59 } AclItem;
60 
61 /*
62  * The upper 16 bits of the ai_privs field of an AclItem are the grant option
63  * bits, and the lower 16 bits are the actual privileges. We use "rights"
64  * to mean the combined grant option and privilege bits fields.
65  */
66 #define ACLITEM_GET_PRIVS(item) ((item).ai_privs & 0xFFFF)
67 #define ACLITEM_GET_GOPTIONS(item) (((item).ai_privs >> 16) & 0xFFFF)
68 #define ACLITEM_GET_RIGHTS(item) ((item).ai_privs)
69 
70 #define ACL_GRANT_OPTION_FOR(privs) (((AclMode) (privs) & 0xFFFF) << 16)
71 #define ACL_OPTION_TO_PRIVS(privs) (((AclMode) (privs) >> 16) & 0xFFFF)
72 
73 #define ACLITEM_SET_PRIVS(item,privs) \
74  ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0xFFFF)) | \
75  ((AclMode) (privs) & 0xFFFF))
76 #define ACLITEM_SET_GOPTIONS(item,goptions) \
77  ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0xFFFF) << 16)) | \
78  (((AclMode) (goptions) & 0xFFFF) << 16))
79 #define ACLITEM_SET_RIGHTS(item,rights) \
80  ((item).ai_privs = (AclMode) (rights))
81 
82 #define ACLITEM_SET_PRIVS_GOPTIONS(item,privs,goptions) \
83  ((item).ai_privs = ((AclMode) (privs) & 0xFFFF) | \
84  (((AclMode) (goptions) & 0xFFFF) << 16))
85 
86 
87 #define ACLITEM_ALL_PRIV_BITS ((AclMode) 0xFFFF)
88 #define ACLITEM_ALL_GOPTION_BITS ((AclMode) 0xFFFF << 16)
89 
90 /*
91  * Definitions for convenient access to Acl (array of AclItem).
92  * These are standard PostgreSQL arrays, but are restricted to have one
93  * dimension and no nulls. We also ignore the lower bound when reading,
94  * and set it to one when writing.
95  *
96  * CAUTION: as of PostgreSQL 7.1, these arrays are toastable (just like all
97  * other array types). Therefore, be careful to detoast them with the
98  * macros provided, unless you know for certain that a particular array
99  * can't have been toasted.
100  */
101 
102 
103 /*
104  * Acl a one-dimensional array of AclItem
105  */
106 typedef struct ArrayType Acl;
107 
108 #define ACL_NUM(ACL) (ARR_DIMS(ACL)[0])
109 #define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL))
110 #define ACL_N_SIZE(N) (ARR_OVERHEAD_NONULLS(1) + ((N) * sizeof(AclItem)))
111 #define ACL_SIZE(ACL) ARR_SIZE(ACL)
112 
113 /*
114  * fmgr macros for these types
115  */
116 #define DatumGetAclItemP(X) ((AclItem *) DatumGetPointer(X))
117 #define PG_GETARG_ACLITEM_P(n) DatumGetAclItemP(PG_GETARG_DATUM(n))
118 #define PG_RETURN_ACLITEM_P(x) PG_RETURN_POINTER(x)
119 
120 #define DatumGetAclP(X) ((Acl *) PG_DETOAST_DATUM(X))
121 #define DatumGetAclPCopy(X) ((Acl *) PG_DETOAST_DATUM_COPY(X))
122 #define PG_GETARG_ACL_P(n) DatumGetAclP(PG_GETARG_DATUM(n))
123 #define PG_GETARG_ACL_P_COPY(n) DatumGetAclPCopy(PG_GETARG_DATUM(n))
124 #define PG_RETURN_ACL_P(x) PG_RETURN_POINTER(x)
125 
126 /*
127  * ACL modification opcodes for aclupdate
128  */
129 #define ACL_MODECHG_ADD 1
130 #define ACL_MODECHG_DEL 2
131 #define ACL_MODECHG_EQL 3
132 
133 /*
134  * External representations of the privilege bits --- aclitemin/aclitemout
135  * represent each possible privilege bit with a distinct 1-character code
136  */
137 #define ACL_INSERT_CHR 'a' /* formerly known as "append" */
138 #define ACL_SELECT_CHR 'r' /* formerly known as "read" */
139 #define ACL_UPDATE_CHR 'w' /* formerly known as "write" */
140 #define ACL_DELETE_CHR 'd'
141 #define ACL_TRUNCATE_CHR 'D' /* super-delete, as it were */
142 #define ACL_REFERENCES_CHR 'x'
143 #define ACL_TRIGGER_CHR 't'
144 #define ACL_EXECUTE_CHR 'X'
145 #define ACL_USAGE_CHR 'U'
146 #define ACL_CREATE_CHR 'C'
147 #define ACL_CREATE_TEMP_CHR 'T'
148 #define ACL_CONNECT_CHR 'c'
149 
150 /* string holding all privilege code chars, in order by bitmask position */
151 #define ACL_ALL_RIGHTS_STR "arwdDxtXUCTc"
152 
153 /*
154  * Bitmasks defining "all rights" for each supported object type
155  */
156 #define ACL_ALL_RIGHTS_COLUMN (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_REFERENCES)
157 #define ACL_ALL_RIGHTS_RELATION (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_DELETE|ACL_TRUNCATE|ACL_REFERENCES|ACL_TRIGGER)
158 #define ACL_ALL_RIGHTS_SEQUENCE (ACL_USAGE|ACL_SELECT|ACL_UPDATE)
159 #define ACL_ALL_RIGHTS_DATABASE (ACL_CREATE|ACL_CREATE_TEMP|ACL_CONNECT)
160 #define ACL_ALL_RIGHTS_FDW (ACL_USAGE)
161 #define ACL_ALL_RIGHTS_FOREIGN_SERVER (ACL_USAGE)
162 #define ACL_ALL_RIGHTS_FUNCTION (ACL_EXECUTE)
163 #define ACL_ALL_RIGHTS_LANGUAGE (ACL_USAGE)
164 #define ACL_ALL_RIGHTS_LARGEOBJECT (ACL_SELECT|ACL_UPDATE)
165 #define ACL_ALL_RIGHTS_SCHEMA (ACL_USAGE|ACL_CREATE)
166 #define ACL_ALL_RIGHTS_TABLESPACE (ACL_CREATE)
167 #define ACL_ALL_RIGHTS_TYPE (ACL_USAGE)
168 
169 /* operation codes for pg_*_aclmask */
170 typedef enum
171 {
172  ACLMASK_ALL, /* normal case: compute all bits */
173  ACLMASK_ANY /* return when result is known nonzero */
174 } AclMaskHow;
175 
176 /* result codes for pg_*_aclcheck */
177 typedef enum
178 {
182 } AclResult;
183 
184 
185 /*
186  * routines used internally
187  */
188 extern Acl *acldefault(ObjectType objtype, Oid ownerId);
189 extern Acl *get_user_default_acl(ObjectType objtype, Oid ownerId,
190  Oid nsp_oid);
191 extern void recordDependencyOnNewAcl(Oid classId, Oid objectId, int32 objsubId,
192  Oid ownerId, Acl *acl);
193 
194 extern Acl *aclupdate(const Acl *old_acl, const AclItem *mod_aip,
195  int modechg, Oid ownerId, DropBehavior behavior);
196 extern Acl *aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId);
197 extern Acl *make_empty_acl(void);
198 extern Acl *aclcopy(const Acl *orig_acl);
199 extern Acl *aclconcat(const Acl *left_acl, const Acl *right_acl);
200 extern Acl *aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId);
201 extern void aclitemsort(Acl *acl);
202 extern bool aclequal(const Acl *left_acl, const Acl *right_acl);
203 
204 extern AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId,
205  AclMode mask, AclMaskHow how);
206 extern int aclmembers(const Acl *acl, Oid **roleids);
207 
208 extern bool has_privs_of_role(Oid member, Oid role);
209 extern bool is_member_of_role(Oid member, Oid role);
210 extern bool is_member_of_role_nosuper(Oid member, Oid role);
211 extern bool is_admin_of_role(Oid member, Oid role);
212 extern void check_is_member_of_role(Oid member, Oid role);
213 extern Oid get_role_oid(const char *rolename, bool missing_ok);
214 extern Oid get_role_oid_or_public(const char *rolename);
215 extern Oid get_rolespec_oid(const RoleSpec *role, bool missing_ok);
216 extern void check_rolespec_name(const RoleSpec *role, const char *detail_msg);
217 extern HeapTuple get_rolespec_tuple(const RoleSpec *role);
218 extern char *get_rolespec_name(const RoleSpec *role);
219 
220 extern void select_best_grantor(Oid roleId, AclMode privileges,
221  const Acl *acl, Oid ownerId,
222  Oid *grantorId, AclMode *grantOptions);
223 
224 extern void initialize_acl(void);
225 
226 /*
227  * prototypes for functions in aclchk.c
228  */
229 extern void ExecuteGrantStmt(GrantStmt *stmt);
231 
232 extern void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid);
233 
235  Oid roleid, AclMode mask, AclMaskHow how);
237  Oid roleid, AclMode mask,
238  AclMaskHow how, bool *is_missing);
239 extern AclMode pg_class_aclmask(Oid table_oid, Oid roleid,
240  AclMode mask, AclMaskHow how);
241 extern AclMode pg_class_aclmask_ext(Oid table_oid, Oid roleid,
242  AclMode mask, AclMaskHow how,
243  bool *is_missing);
244 extern AclMode pg_database_aclmask(Oid db_oid, Oid roleid,
245  AclMode mask, AclMaskHow how);
246 extern AclMode pg_proc_aclmask(Oid proc_oid, Oid roleid,
247  AclMode mask, AclMaskHow how);
248 extern AclMode pg_language_aclmask(Oid lang_oid, Oid roleid,
249  AclMode mask, AclMaskHow how);
250 extern AclMode pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid,
251  AclMode mask, AclMaskHow how, Snapshot snapshot);
252 extern AclMode pg_namespace_aclmask(Oid nsp_oid, Oid roleid,
253  AclMode mask, AclMaskHow how);
254 extern AclMode pg_tablespace_aclmask(Oid spc_oid, Oid roleid,
255  AclMode mask, AclMaskHow how);
256 extern AclMode pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid,
257  AclMode mask, AclMaskHow how);
258 extern AclMode pg_foreign_server_aclmask(Oid srv_oid, Oid roleid,
259  AclMode mask, AclMaskHow how);
260 extern AclMode pg_type_aclmask(Oid type_oid, Oid roleid,
261  AclMode mask, AclMaskHow how);
262 
264  Oid roleid, AclMode mode);
266  Oid roleid, AclMode mode,
267  bool *is_missing);
268 extern AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid,
269  AclMode mode, AclMaskHow how);
270 extern AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode);
271 extern AclResult pg_class_aclcheck_ext(Oid table_oid, Oid roleid,
272  AclMode mode, bool *is_missing);
273 extern AclResult pg_database_aclcheck(Oid db_oid, Oid roleid, AclMode mode);
274 extern AclResult pg_proc_aclcheck(Oid proc_oid, Oid roleid, AclMode mode);
275 extern AclResult pg_language_aclcheck(Oid lang_oid, Oid roleid, AclMode mode);
276 extern AclResult pg_largeobject_aclcheck_snapshot(Oid lang_oid, Oid roleid,
277  AclMode mode, Snapshot snapshot);
278 extern AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid roleid, AclMode mode);
279 extern AclResult pg_tablespace_aclcheck(Oid spc_oid, Oid roleid, AclMode mode);
281 extern AclResult pg_foreign_server_aclcheck(Oid srv_oid, Oid roleid, AclMode mode);
282 extern AclResult pg_type_aclcheck(Oid type_oid, Oid roleid, AclMode mode);
283 
284 extern void aclcheck_error(AclResult aclerr, ObjectType objtype,
285  const char *objectname);
286 
287 extern void aclcheck_error_col(AclResult aclerr, ObjectType objtype,
288  const char *objectname, const char *colname);
289 
290 extern void aclcheck_error_type(AclResult aclerr, Oid typeOid);
291 
292 extern void recordExtObjInitPriv(Oid objoid, Oid classoid);
293 extern void removeExtObjInitPriv(Oid objoid, Oid classoid);
294 
295 
296 /* ownercheck routines just return true (owner) or false (not) */
297 extern bool pg_class_ownercheck(Oid class_oid, Oid roleid);
298 extern bool pg_type_ownercheck(Oid type_oid, Oid roleid);
299 extern bool pg_oper_ownercheck(Oid oper_oid, Oid roleid);
300 extern bool pg_proc_ownercheck(Oid proc_oid, Oid roleid);
301 extern bool pg_language_ownercheck(Oid lan_oid, Oid roleid);
302 extern bool pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid);
303 extern bool pg_namespace_ownercheck(Oid nsp_oid, Oid roleid);
304 extern bool pg_tablespace_ownercheck(Oid spc_oid, Oid roleid);
305 extern bool pg_opclass_ownercheck(Oid opc_oid, Oid roleid);
306 extern bool pg_opfamily_ownercheck(Oid opf_oid, Oid roleid);
307 extern bool pg_database_ownercheck(Oid db_oid, Oid roleid);
308 extern bool pg_collation_ownercheck(Oid coll_oid, Oid roleid);
309 extern bool pg_conversion_ownercheck(Oid conv_oid, Oid roleid);
310 extern bool pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid);
311 extern bool pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid);
312 extern bool pg_foreign_data_wrapper_ownercheck(Oid srv_oid, Oid roleid);
313 extern bool pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid);
314 extern bool pg_event_trigger_ownercheck(Oid et_oid, Oid roleid);
315 extern bool pg_extension_ownercheck(Oid ext_oid, Oid roleid);
316 extern bool pg_publication_ownercheck(Oid pub_oid, Oid roleid);
317 extern bool pg_subscription_ownercheck(Oid sub_oid, Oid roleid);
318 extern bool pg_statistics_object_ownercheck(Oid stat_oid, Oid roleid);
319 extern bool has_createrole_privilege(Oid roleid);
320 extern bool has_bypassrls_privilege(Oid roleid);
321 
322 #endif /* ACL_H */
Oid ai_grantee
Definition: acl.h:56
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4680
bool pg_opclass_ownercheck(Oid opc_oid, Oid roleid)
Definition: aclchk.c:5047
static PgChecksumMode mode
Definition: pg_checksums.c:63
void aclitemsort(Acl *acl)
Definition: acl.c:481
bool pg_oper_ownercheck(Oid oper_oid, Oid roleid)
Definition: aclchk.c:4870
bool aclequal(const Acl *left_acl, const Acl *right_acl)
Definition: acl.c:495
bool pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid)
Definition: aclchk.c:5128
AclResult pg_proc_aclcheck(Oid proc_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4718
bool pg_database_ownercheck(Oid db_oid, Oid roleid)
Definition: aclchk.c:5236
AclMode pg_tablespace_aclmask(Oid spc_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:4287
AclResult pg_attribute_aclcheck_ext(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mode, bool *is_missing)
Definition: aclchk.c:4565
bool pg_language_ownercheck(Oid lan_oid, Oid roleid)
Definition: aclchk.c:4922
bool pg_publication_ownercheck(Oid pub_oid, Oid roleid)
Definition: aclchk.c:5356
Acl * aclupdate(const Acl *old_acl, const AclItem *mod_aip, int modechg, Oid ownerId, DropBehavior behavior)
Definition: acl.c:916
AclMode pg_foreign_server_aclmask(Oid srv_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:4406
AclMode pg_type_aclmask(Oid type_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:4467
struct AclItem AclItem
Acl * aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId)
Definition: acl.c:1037
AclMode pg_class_aclmask(Oid table_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:3820
AclResult pg_largeobject_aclcheck_snapshot(Oid lang_oid, Oid roleid, AclMode mode, Snapshot snapshot)
Definition: aclchk.c:4742
void recordDependencyOnNewAcl(Oid classId, Oid objectId, int32 objsubId, Oid ownerId, Acl *acl)
Definition: aclchk.c:5597
AclMode pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:3701
AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mode)
Definition: aclchk.c:4551
bool pg_foreign_data_wrapper_ownercheck(Oid srv_oid, Oid roleid)
Definition: aclchk.c:5155
Oid get_rolespec_oid(const RoleSpec *role, bool missing_ok)
Definition: acl.c:5128
bool pg_statistics_object_ownercheck(Oid stat_oid, Oid roleid)
Definition: aclchk.c:5408
bool is_member_of_role_nosuper(Oid member, Oid role)
Definition: acl.c:4909
void ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *stmt)
Definition: aclchk.c:905
AclMode pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:4344
AclResult pg_foreign_server_aclcheck(Oid srv_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4794
unsigned int Oid
Definition: postgres_ext.h:31
bool pg_extension_ownercheck(Oid ext_oid, Oid roleid)
Definition: aclchk.c:5314
Acl * aclcopy(const Acl *orig_acl)
Definition: acl.c:393
Oid ai_grantor
Definition: acl.h:57
bool has_createrole_privilege(Oid roleid)
Definition: aclchk.c:5443
void removeExtObjInitPriv(Oid objoid, Oid classoid)
Definition: aclchk.c:5925
bool pg_type_ownercheck(Oid type_oid, Oid roleid)
Definition: aclchk.c:4844
signed int int32
Definition: c.h:429
bool pg_tablespace_ownercheck(Oid spc_oid, Oid roleid)
Definition: aclchk.c:5020
void ExecuteGrantStmt(GrantStmt *stmt)
Definition: aclchk.c:360
bool pg_conversion_ownercheck(Oid conv_oid, Oid roleid)
Definition: aclchk.c:5288
AclMode ai_privs
Definition: acl.h:58
Oid get_role_oid(const char *rolename, bool missing_ok)
Definition: acl.c:5094
uint32 AclMode
Definition: parsenodes.h:80
void select_best_grantor(Oid roleId, AclMode privileges, const Acl *acl, Oid ownerId, Oid *grantorId, AclMode *grantOptions)
Definition: acl.c:5018
AclResult pg_tablespace_aclcheck(Oid spc_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4768
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
Definition: aclchk.c:3308
AclResult pg_database_aclcheck(Oid db_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4706
AclMode pg_namespace_aclmask(Oid nsp_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:4195
AclMode pg_language_aclmask(Oid lang_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:4059
AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode, AclMaskHow how)
Definition: aclchk.c:4595
int aclmembers(const Acl *acl, Oid **roleids)
Definition: acl.c:1458
AclResult pg_language_aclcheck(Oid lang_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4730
AclMode pg_class_aclmask_ext(Oid table_oid, Oid roleid, AclMode mask, AclMaskHow how, bool *is_missing)
Definition: aclchk.c:3833
bool pg_subscription_ownercheck(Oid sub_oid, Oid roleid)
Definition: aclchk.c:5382
void aclcheck_error_type(AclResult aclerr, Oid typeOid)
Definition: aclchk.c:3621
void recordExtObjInitPriv(Oid objoid, Oid classoid)
Definition: aclchk.c:5627
AclMode pg_database_aclmask(Oid db_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:3951
bool pg_collation_ownercheck(Oid coll_oid, Oid roleid)
Definition: aclchk.c:5262
AclResult pg_namespace_aclcheck(Oid nsp_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4756
Acl * get_user_default_acl(ObjectType objtype, Oid ownerId, Oid nsp_oid)
Definition: aclchk.c:5521
ObjectType
Definition: parsenodes.h:1775
AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId, AclMode mask, AclMaskHow how)
Definition: acl.c:1306
bool is_admin_of_role(Oid member, Oid role)
Definition: acl.c:4931
DropBehavior
Definition: parsenodes.h:1846
bool pg_event_trigger_ownercheck(Oid et_oid, Oid roleid)
Definition: aclchk.c:5209
AclResult
Definition: acl.h:177
AclMode pg_attribute_aclmask_ext(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mask, AclMaskHow how, bool *is_missing)
Definition: aclchk.c:3715
AclResult pg_foreign_data_wrapper_aclcheck(Oid fdw_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4781
bool pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid)
Definition: aclchk.c:5182
int16 attnum
Definition: pg_attribute.h:83
void initialize_acl(void)
Definition: acl.c:4648
Definition: acl.h:54
AclResult pg_type_aclcheck(Oid type_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4806
AclMode pg_proc_aclmask(Oid proc_oid, Oid roleid, AclMode mask, AclMaskHow how)
Definition: aclchk.c:4005
AclMode pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid, AclMode mask, AclMaskHow how, Snapshot snapshot)
Definition: aclchk.c:4122
bool pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid)
Definition: aclchk.c:5101
bool pg_opfamily_ownercheck(Oid opf_oid, Oid roleid)
Definition: aclchk.c:5074
char * get_rolespec_name(const RoleSpec *role)
Definition: acl.c:5213
void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid)
Definition: aclchk.c:1391
void aclcheck_error_col(AclResult aclerr, ObjectType objtype, const char *objectname, const char *colname)
Definition: aclchk.c:3591
AclMaskHow
Definition: acl.h:170
Oid get_role_oid_or_public(const char *rolename)
Definition: acl.c:5112
bool pg_proc_ownercheck(Oid proc_oid, Oid roleid)
Definition: aclchk.c:4896
bool has_bypassrls_privilege(Oid roleid)
Definition: aclchk.c:5462
void check_rolespec_name(const RoleSpec *role, const char *detail_msg)
Definition: acl.c:5235
Acl * make_empty_acl(void)
Definition: acl.c:384
bool pg_class_ownercheck(Oid class_oid, Oid roleid)
Definition: aclchk.c:4818
bool is_member_of_role(Oid member, Oid role)
Definition: acl.c:4869
Acl * aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId)
Definition: acl.c:437
int16 AttrNumber
Definition: attnum.h:21
void check_is_member_of_role(Oid member, Oid role)
Definition: acl.c:4893
AclResult pg_class_aclcheck_ext(Oid table_oid, Oid roleid, AclMode mode, bool *is_missing)
Definition: aclchk.c:4692
bool has_privs_of_role(Oid member, Oid role)
Definition: acl.c:4843
HeapTuple get_rolespec_tuple(const RoleSpec *role)
Definition: acl.c:5167
bool pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid)
Definition: aclchk.c:4951
bool pg_namespace_ownercheck(Oid nsp_oid, Oid roleid)
Definition: aclchk.c:4994
Acl * aclconcat(const Acl *left_acl, const Acl *right_acl)
Definition: acl.c:413
Acl * acldefault(ObjectType objtype, Oid ownerId)
Definition: acl.c:734