mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Restructure aclcheck error reporting to make permission-failure
messages more uniform and internationalizable: the global array aclcheck_error_strings[] is gone in favor of a subroutine aclcheck_error(). Partial implementation of namespace-related permission checks --- not all done yet.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.68 2002/04/19 23:13:54 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.69 2002/04/27 03:45:03 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -127,7 +127,7 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
*event_qualP;
|
||||
List *l;
|
||||
Query *query;
|
||||
int32 aclcheck_result;
|
||||
AclResult aclresult;
|
||||
bool RelisBecomingView = false;
|
||||
|
||||
/*
|
||||
@ -144,11 +144,9 @@ DefineQueryRewrite(RuleStmt *stmt)
|
||||
/*
|
||||
* Check user has permission to apply rules to this relation.
|
||||
*/
|
||||
aclcheck_result = pg_class_aclcheck(ev_relid, GetUserId(), ACL_RULE);
|
||||
if (aclcheck_result != ACLCHECK_OK)
|
||||
elog(ERROR, "%s: %s",
|
||||
RelationGetRelationName(event_relation),
|
||||
aclcheck_error_strings[aclcheck_result]);
|
||||
aclresult = pg_class_aclcheck(ev_relid, GetUserId(), ACL_RULE);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, RelationGetRelationName(event_relation));
|
||||
|
||||
/*
|
||||
* No rule actions that modify OLD or NEW
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.48 2002/04/18 20:01:09 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.49 2002/04/27 03:45:03 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -42,7 +42,7 @@ RemoveRewriteRule(Oid owningRel, const char *ruleName)
|
||||
Oid ruleId;
|
||||
Oid eventRelationOid;
|
||||
bool hasMoreRules;
|
||||
int32 aclcheck_result;
|
||||
AclResult aclresult;
|
||||
|
||||
/*
|
||||
* Open the pg_rewrite relation.
|
||||
@ -82,12 +82,9 @@ RemoveRewriteRule(Oid owningRel, const char *ruleName)
|
||||
/*
|
||||
* Verify user has appropriate permissions.
|
||||
*/
|
||||
aclcheck_result = pg_class_aclcheck(eventRelationOid, GetUserId(),
|
||||
ACL_RULE);
|
||||
if (aclcheck_result != ACLCHECK_OK)
|
||||
elog(ERROR, "%s: %s",
|
||||
RelationGetRelationName(event_relation),
|
||||
aclcheck_error_strings[aclcheck_result]);
|
||||
aclresult = pg_class_aclcheck(eventRelationOid, GetUserId(), ACL_RULE);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, RelationGetRelationName(event_relation));
|
||||
|
||||
/* do not allow the removal of a view's SELECT rule */
|
||||
if (event_relation->rd_rel->relkind == RELKIND_VIEW &&
|
||||
|
Reference in New Issue
Block a user