/* *TemporarilyswitchtoanewuserID. * *Ifthecurrentuserdoesn'thavepermissiontoSETROLEtothenewuser, *anERRORoccurs. * *Ifthenewuserdoesn'thavepermissiontoSETROLEtothecurrentuser, *SECURITY_RESTRICTED_OPERATIONisimposedandanewGUCnestlevelis *createdsothatanysettingschangescanberolledback.
*/ void
SwitchToUntrustedUser(Oid userid, UserContext *context)
{ /* Get the current user ID and security context. */
GetUserIdAndSecContext(&context->save_userid,
&context->save_sec_context);
/* Check that we have sufficient privileges to assume the target role. */ if (!member_can_set_role(context->save_userid, userid))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("role \"%s\" cannot SET ROLE to \"%s\"",
GetUserNameFromId(context->save_userid, false),
GetUserNameFromId(userid, false))));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.