Fix a bug and support empty username in $data->isSuperUser to check the superUser...
authorJehan-Guillaume (ioguix) de Rorthais <jgdr@dalibo.com>
Wed, 1 Jun 2011 19:23:37 +0000 (21:23 +0200)
committerJehan-Guillaume (ioguix) de Rorthais <jgdr@dalibo.com>
Wed, 1 Jun 2011 19:23:37 +0000 (21:23 +0200)
Fixed a bug on the way as in previous version it was checking if function
pg_parameter_status exists and used it directly, hence testing only the
currently used role.
pg_parameter_status is available in PHP 5.*

classes/database/Postgres.php

index 4b0199315b809c91bd0a78af2a00b7e8693225fc..588a2cc3ab5e9a6f0b6e80fe8e8044271745241a 100755 (executable)
@@ -6467,10 +6467,10 @@ class Postgres extends ADODB_base {
         * @param $username The username of the user
         * @return True if is a super user, false otherwise
         */
-       function isSuperUser($username) {
+       function isSuperUser($username = '') {
                $this->clean($username);
 
-               if (function_exists('pg_parameter_status')) {
+               if (empty($usename)) {
                        $val = pg_parameter_status($this->conn->_connectionID, 'is_superuser');
                        if ($val !== false) return $val == 'on';
                }