From da0480290c23a8934ea12c95740563b09be2393a Mon Sep 17 00:00:00 2001 From: "Guillaume (ioguix) de Rorthais" Date: Sat, 20 Dec 2008 00:59:53 -0500 Subject: [PATCH] Fix setRenameRole and setRenameUser to be able to rename role/user AND password in the same time --- classes/database/Postgres.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index 2a1cf27d..460d0aed 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -5840,18 +5840,19 @@ class Postgres extends ADODB_base { $status = $this->beginTransaction(); if ($status != 0) return -1; - $status = $this->setRole($rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold); - if ($status != 0) { - $this->rollbackTransaction(); - return -2; - } - if ($rolename != $newrolename){ $status = $this->renameRole($rolename, $newrolename); if ($status != 0) { $this->rollbackTransaction(); return -3; } + $rolename = $newrolename; + } + + $status = $this->setRole($rolename, $password, $superuser, $createdb, $createrole, $inherits, $login, $connlimit, $expiry, $memberof, $members, $adminmembers, $memberofold, $membersold, $adminmembersold); + if ($status != 0) { + $this->rollbackTransaction(); + return -2; } return $this->endTransaction(); @@ -5955,18 +5956,19 @@ class Postgres extends ADODB_base { $status = $this->beginTransaction(); if ($status != 0) return -1; - $status = $this->setUser($username, $password, $createdb, $createuser, $expiry); - if ($status != 0) { - $this->rollbackTransaction(); - return -2; - } - if ($username != $newname){ $status = $this->renameUser($username, $newname); if ($status != 0) { $this->rollbackTransaction(); return -3; } + $username = $newname; + } + + $status = $this->setUser($username, $password, $createdb, $createuser, $expiry); + if ($status != 0) { + $this->rollbackTransaction(); + return -2; } return $this->endTransaction(); -- 2.39.5