mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
Replace AclObjectKind with ObjectType
AclObjectKind was basically just another enumeration for object types, and we already have a preferred one for that. It's only used in aclcheck_error. By using ObjectType instead, we can also give some more precise error messages, for example "index" instead of "relation". Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
@ -95,7 +95,7 @@ DefineOperator(List *names, List *parameters)
|
||||
/* Check we have creation rights in target namespace */
|
||||
aclresult = pg_namespace_aclcheck(oprNamespace, GetUserId(), ACL_CREATE);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_NAMESPACE,
|
||||
aclcheck_error(aclresult, OBJECT_SCHEMA,
|
||||
get_namespace_name(oprNamespace));
|
||||
|
||||
/*
|
||||
@ -215,7 +215,7 @@ DefineOperator(List *names, List *parameters)
|
||||
*/
|
||||
aclresult = pg_proc_aclcheck(functionOid, GetUserId(), ACL_EXECUTE);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
aclcheck_error(aclresult, OBJECT_FUNCTION,
|
||||
NameListToString(functionName));
|
||||
|
||||
rettype = get_func_rettype(functionOid);
|
||||
@ -281,7 +281,7 @@ ValidateRestrictionEstimator(List *restrictionName)
|
||||
/* Require EXECUTE rights for the estimator */
|
||||
aclresult = pg_proc_aclcheck(restrictionOid, GetUserId(), ACL_EXECUTE);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
aclcheck_error(aclresult, OBJECT_FUNCTION,
|
||||
NameListToString(restrictionName));
|
||||
|
||||
return restrictionOid;
|
||||
@ -327,7 +327,7 @@ ValidateJoinEstimator(List *joinName)
|
||||
/* Require EXECUTE rights for the estimator */
|
||||
aclresult = pg_proc_aclcheck(joinOid, GetUserId(), ACL_EXECUTE);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_PROC,
|
||||
aclcheck_error(aclresult, OBJECT_FUNCTION,
|
||||
NameListToString(joinName));
|
||||
|
||||
return joinOid;
|
||||
@ -457,7 +457,7 @@ AlterOperator(AlterOperatorStmt *stmt)
|
||||
|
||||
/* Check permissions. Must be owner. */
|
||||
if (!pg_oper_ownercheck(oprId, GetUserId()))
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER,
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_OPERATOR,
|
||||
NameStr(oprForm->oprname));
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user