Permalink
Browse files

Fix a bug and support empty username in $data->isSuperUser to check t…

…he superUser status of the current role

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.*
  • Loading branch information...
1 parent 18cdc40 commit 4e7fc159a48612b47e9e9de6b91776d4fa96b732 @ioguix ioguix committed Jun 1, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 classes/database/Postgres.php
@@ -6467,10 +6467,10 @@ function dropUser($username) {
* @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';
}

0 comments on commit 4e7fc15

Please sign in to comment.